I am encountered one issue with Android's alarm manager. I am scheduling a 
repeating notification on DST enabled area.
Here are my timezone settings

 - Region: Canada 
 - TimeZone: Vancouver 
 - Device: S9+ Android 10 
 - DST Starts on - **March 8** & DST ends on - **Nov-1**

I scheduled a notification on **February 29 at 9:00 AM** notification comes 
successfully, but **after DST Starts** on **March 9th** the notification 
fired at **10:00 AM**. after DST ends it is back to normal.
I need to fire the notification at exactly 9:00 AM every day independent of 
DST. Is this behavior is normal? there are no issues with iOS devices. 

 - Is this is a bug from the Android side?
 - How to schedule the notification independent of DST?

Can anyone help me?

Here is my code to schedule the notification

**Note: I have added the AlarmManager.RTC_WAKEUP as the alarm type and 
scheduled the interval as AlarmManager.INTERVAL_DAY. also, passed the UTC 
time to the alarm manager from the calendars calendar.getTimeInMillis() 
method.**

    alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(this, AlarmReceiver.class);
        alarmIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        calendar.set(Calendar.HOUR_OF_DAY, 9);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, 
calendar.getTimeInMillis(),
                AlarmManager.INTERVAL_DAY, alarmIntent);


**Test Procedure:**

Setting the  **Region: Canada & TimeZone: Vancouver** 
 1. Schedule a repeating notification on Feb 15th at 9:00 AM
 2. Test whether the notification fired on Feb 16th at 9:00 AM -> 
**Success, notification fired at 9:00 AM**
 3. change the system time to March 9th (Which is on DST); observing the 
notification fires at 9:00 AM -> **Failed, it fired on 10:00 AM**
 4. Change the date to Nov 2nd (DST Ended) ; observing the notification 
fires at 9:00AM -> **Success notification fired at 9:00 AM** 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/d679181f-861e-45ad-b8a6-bb30d1e4533fn%40googlegroups.com.

Reply via email to