Search code examples
androidalarmmanagerandroid-version

Android getTriggerTime different results in Android version 9.0


I just started to develop my Android app for alarm management and I discovered that getTriggerTime() (from [AlarmManagement][1] class offered by Android API) returns different results in different Android versions.

Let's say I have code something like this:

AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
long alarmTime= am.getNextAlarmClock().getTriggerTime();

If alarmTime milliseconds are converted into date and time then in Android versions 5,6,8 it returns correct time and date of the alarm. However in version 9 it returns date and time 5 minutes prior to the real alarm time. Actually, I am not sure if version 9 is the problem or something is wrong with the three Samsung galaxy S9 phones I tested it on.

So now I don't know what to do with my findings. Any advice? Do I have to treat this somehow in my code (if android version X than add + 5 minutes)? It sounds very unprofessional.


Solution

  • This bug is related to Samsung clock app. https://eu.community.samsung.com/t5/Galaxy-S9-S9/Pie-Clock-app-bug/td-p/927333