AlarmManager does not work at a specific time, but ~ 5 minutes after a specified time ... Why? And it also works if I activate it by time. That is, if it is set at 10:00, and I activate it at 11:00, then in theory it should work tomorrow at 10:00, but it works every minute. And it will work tomorrow at ~ 10: 05
void setMorningAlarm(Context context){ AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, AlarmManagerBroadcastReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(context, morningId, intent, 0); Calendar time = Calendar.getInstance(); time.set(Calendar.HOUR_OF_DAY, 8); time.set(Calendar.MINUTE, 0); alarmManager.setInexactRepeating( AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi); Toast.makeText(context,"Morning Notify", Toast.LENGTH_SHORT).show(); }