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
New Developer
BBDev
Posts: 20
Registered: ‎07-17-2008
My Device: Not Specified

GlobalEventListener Issue

Here is the main class of my application. Issue is when device time automatically goes from 11:59pm to 12:00 am, means date change , at that point of time "eventOccurred" call is not occured. Any Idea?

 

When I manually change the date then that callback comes.

 

 

package src.com.blackberry;

import net.rim.device.api.system.GlobalEventListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.util.DateTimeUtilities;

class SampleApp extends UiApplication implements GlobalEventListener
{
    public static void main(String args[])
    {
        SampleApp app = new SampleApp();
        app.enterEventDispatcher();
    }

    public SampleApp()
    {
        addGlobalEventListener(this);

        DisplayScr scr = new DisplayScr();
        pushScreen(scr);
       
    }

    public void eventOccurred(long arg0, int arg1, int arg2, Object arg3,
        Object arg4)
    {
        if (arg0 == DateTimeUtilities.GUID_DATE_CHANGED){
            System.out.println("Date Changed");
        }

       
    }

}

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: GlobalEventListener Issue

maybe the event is only used for external date changes (user or timeserver changes date)
----------------------------------------------------------
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
Please use plain text.
New Developer
BBDev
Posts: 20
Registered: ‎07-17-2008
My Device: Not Specified

Re: GlobalEventListener Issue

Thanks Simon for your quick response,

 

  Is there any other method/event, which tells the app that device's date has been changed(automatically , not manually).

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: GlobalEventListener Issue

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
Please use plain text.
Contributor
lironhel
Posts: 44
Registered: ‎10-28-2010
My Device: Not Specified

Re: GlobalEventListener Issue

I guess that you dont need to know that the time had changed, since it changes all the time ......

 

if i read you write , you need to know when a specific time \ date is now.

 

i guess your can use the Timer class and the TimerTask, or you can create your own thread and wait till the passed time had passed.

 

cheers

 

Please use plain text.
New Developer
BBDev
Posts: 20
Registered: ‎07-17-2008
My Device: Not Specified

Re: GlobalEventListener Issue

Simon - But clockUpdated() event comes each minutes. How can we calculate that its midnight or date changed?

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: GlobalEventListener Issue

you use system.currentTimeMillis and check if its a new date, for example.
----------------------------------------------------------
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
Please use plain text.