I\'m stuck on this problem. I\'ve read many solutions on stack overflow but none of these have solved my problem.
Here\'s my code: In my Main Activity, I wrote this--
if (alarmRun == false){
PendingIntent pending = PendingIntent.getBroadcast(this.context, 0, alarm, 0);
AlarmManager alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmMgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), 15000, pending);
}
Calling setRepeating
will cause the BroadcastReceiver
to be triggered multiple times at an interval of 15000 milliseconds. Use setExact
instead.