Repeat the alarm every day at a specific time (alarm manager)

Hi, I want my application to start at a specific time every day. I use the code below for this. But it works only once. What a mistake here, how can I achieve this.

AlarmManager alarmMgr0 = (AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent intent0 = new Intent(this, ActivityStarter.class); PendingIntent pendingIntent0 = PendingIntent.getBroadcast(this, 0, intent0, 0); Calendar timeOff9 = Calendar.getInstance(); timeOff9.set(Calendar.HOUR_OF_DAY, 16); timeOff9.set(Calendar.MINUTE, 13); timeOff9.set(Calendar.SECOND, 0); alarmMgr0.setRepeating(AlarmManager.RTC_WAKEUP, timeOff9.getTimeInMillis(),24*60*60*1000,pendingIntent0); 

Any help please.

+2
android android-alarms
source share
1 answer

try it

  alarmMgr0 .setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_DAY, AlarmManager.INTERVAL_DAY, intent); 

send this

+4
source share

All Articles