AlarmManager does not work on time in Android Lollipop

I use this code to install Alarm in Android KitKat and lollipop:

    AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
    Intent i = new Intent(AlarmService.this, Reciver.class);
    PendingIntent pi = PendingIntent.getBroadcast(AlarmService.this, 1201, i, PendingIntent.FLAG_UPDATE_CURRENT);
    Calendar c = Calendar.getInstance();
    c.set(Calendar.HOUR_OF_DAY, 9);
    c.set(Calendar.MINUTE, 0);
    c.set(Calendar.SECOND, 0);
    am.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi);

This code works well on Android KitKat, but on Android Lollipop it fires with a delay of 10 or 5 minutes.

+4
source share
1 answer

This is a known bug in Android Lollipop, which is reported by some other users in the official Android tracker buffer. There is no immediate solution to this problem, but you can get updates on this problem: https://code.google.com/p/android/issues/detail?id=82001

+7
source

Source: https://habr.com/ru/post/1569131/


All Articles