Hello,
I tried to react to time changes, but in the callback I got the old time.
In my test, the DateTime.Now changed 35 seconds after the callback was called.
What I'm doing wrong?
moTimeChangedReceiver = new TimeBroadcastReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.AddAction(Intent.ActionTimeChanged);
intentFilter.AddAction(Intent.ActionTimezoneChanged);
RegisterReceiver(moTimeChangedReceiver, intentFilter);
private class TimeBroadcastReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
String action = intent.Action;
if (action.Equals(Intent.ActionTimeChanged) ||
action.Equals(Intent.ActionTimezoneChanged))
{
DateTime.Now; // returns old time
TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); // returns old time zone
}
}
}
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid