[Solved] Android,sqlite,how to insert date record automatic? [closed]


You can create a Service an use it to add row when you only want (e.g. on boot completed, once per week, etc., etc.).

Here you have good tutorial, how to create Service in Android OS.

Read also more about AlarmManager to start your Service in specific schedule.

Calendar cal = Calendar.getInstance();

Intent intent = new Intent(this, MyService.class);
PendingIntent pintent = PendingIntent.getService(this, 0, intent, 0);

AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
// Start every 30 seconds
alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 30*1000, pintent); 

3

solved Android,sqlite,how to insert date record automatic? [closed]