Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
LSphone
Posts: 140
Registered: ‎02-08-2010
My Device: Torch 9800, Storm 9530, Curve 8330
Accepted Solution

Listen for date / time changes

Is there a way to be notified of a change to the system clock without having to poll the current time?  Like a documented global event that we can rely on across platforms and OS versions?

 

Have an app that must trigger just once a day, exactly at midnight.  Tried Timer.schedule(___, Date()), but apparently that converts the absolute date/time to an interval, because when the time changes, it triggers at the wrong time.

 

If the phone's uptime could be checked, then skew between System.currentTimeMilllis() and the uptime could be detected in a poll timer.  But this is a background app, so it can't get the uptime from UI events, and I don't like polling when it can be avoided.

 

 

Thank You

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Listen for date / time changes

maybe

http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/RealtimeClockListener.h...

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
LSphone
Posts: 140
Registered: ‎02-08-2010
My Device: Torch 9800, Storm 9530, Curve 8330

Re: Listen for date / time changes

Thank you... also, this:

 

net.rim.device.api.util.DateTimeUtilities.GUID_DATE_CHANGED: GUID for the global event sent when the date changes.

 

net.rim.device.api.util.DateTimeUtilities.GUID_TIMEZONE_CHANGED: GUID for the global event sent when the timezone changes.

 

Except there doesn't seem to be a global event for when the time is adjusted, but the RealtimeClockListener will notify of that within a minute.