I use a BroadcastReceiver with TIMEZONE_CHANGED action to reset alarms using AlarmManager just to make sure that the alarm runs exactly at the set time, not a few hours earlier or later, depending on the time zone change.
However in the latest log sent by the user, I saw information about intent with TIMEZONE_CHANGED action being received every few seconds with the user complaining about app being glitchy.
Here's my BroadcastReceiver's onReceive code
@Override
public void onReceive(Context context, Intent intent) {
Utils.log("OnTimeChange");
String action = intent.getAction();
if (action.equals(Intent.ACTION_TIME_CHANGED)) {
Utils.log("TimeChange");
} else if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) {
Utils.log("TimeZoneChanged");
}
BroadcastsManager.updateBroadcastsFromAlarms(context,
AlarmsDbAdapter.getInstance(context));
}
The manifest's intent filter:
<intent-filter>
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
<action android:name="android.intent.action.TIME_SET" />
</intent-filter>
And part of the log (it goes like that for over an hour - full lenght of the log)
1. 19/4 7:41:54 - posting alarm 3 for 8:15 (in 0h)
2. 19/4 7:44:29 - OnTimeChange
3. 19/4 7:44:29 - TimeZoneChanged
4. 19/4 7:44:29 - posting alarm 3 for 8:15 (in 0h)
5. 19/4 7:44:54 - OnTimeChange
6. 19/4 7:44:54 - TimeChange
7. 19/4 7:44:54 - posting alarm 3 for 8:15 (in 0h)
It's a Samsung Galaxy S III (Android v 4.1.2). The strange thing is, that doesn't happen on my S III. Could it be that the user has set "automatic timezone change by provider" option enabled on his/her device and information like that is sent every few seconds?
Has anyone expierienced it? I guess I will just add an option to check if timezone has actually changed before updating broadcasts, but it is still getting the receiver called every few seconds...