03-30-2009 08:05 PM
I am attempting to update my application's OptionsProvider screen by using global events. I use addGlobalListener() in the OptionsProvider populateMainScreen() call. I then use postGlobalEvent() from my application to force the Options application to update the information in the options screen to show the current status of my background application. This seems to work with security off on the simulator and on the Curve with version 4.2 of the OS. But with version 4.5 the Options application does not receive my global events. I see one or two system events in my eventOccurred(), but not my events. I have enabled the following permissions in both my application and the Options applications:
permRequest.addPermission( ApplicationPermissions.PERMISSION_BROWSER_FILTER );
permRequest.addPermission( ApplicationPermissions.PERMISSION_PHONE );
permRequest.addPermission( ApplicationPermissions.PERMISSION_RECORDING );
I would like to communicate between the Options application and my application with low overhead. What is wrong with what I am doing? Is this the best way to update the data displayed in the options applicaiton just like the "Signal" value in the Settings->Options->Options->Status menu on the Curve? I assume that the Runtime store would have too much overhead if I am updating this often, is this correct?
03-31-2009 05:16 AM
03-31-2009 05:36 AM
I agree with Simon that this is a strange error. I also agree that there is little overhead involved in RuntimeStore.
I've just a very minor comment to make, that may or may not be significant.
I'd just be wary about adding a listener in this way, because you don't (necessarily) get the opportunity to remove it. I don't think save() is called if the user escapes from your Options Screen, so any automatically updating Fields within there will continue to do so, and more importantly, will hold a reference to something that your application may wish to free (for example at termination).
You only need this listener to be active while your user is displaying your data, so I would consider having a lower level Screen triggered from the Options Provider MainScreen, that actually does the listening and automatic updating. When this screen is not active, then the listener can be removed. This makes sure you don't keep references to objects that you don't really need.
Just a thought.
09-22-2009 08:23 AM
I want to use globalEventListener in optionprovider, could you please tell me how to do this...
I am not able to addglobaleventlistener to my optionprovider, is it compulsory for process to be of
type application or uiapplication to implement globalEventListener.
09-22-2009 08:53 AM
09-22-2009 12:46 PM
Agree with Simon's comments. Also wished to add the following.
"is it compulsory for process to be of type Application or UiApplication to implement globalEventListener" - Yes
The Process that displays the Options Screens is a UiApplication, so it is possible, while your OptionsProvider screens are active, to add the Listener. You just need to do UiApplication.getUiApplication.addGlobalEventListe
I have an Application that does this, it listens for Global Events only while the User is displaying its Options Screens
09-26-2009 04:30 AM
Hiii, thanks for reply..
few more questions here, so please help me out of this.
I have a thread in optionsprovider and from that thread I want to start an application in which I can implement GlobalEventListener. So,
can I start an application from optionsprovider's thread????, I tried it but runtime exception occurs.
09-26-2009 09:33 AM
I presume that you are trying to do what main() does in a normal application, i.e. instantiate the UiApplication, then call enterEventDisplatcher. If so, it would not surprise me that this does not work.
You can always invoke an Application.
I think you should explain what you are trying to achieve, then perhaps we can tell you how you are supposed to do it on the BlackBerry,
09-26-2009 11:48 AM
let me explain you what the scenario is, actually I want to listen any global event after the dialog box for the missed call appeared.
so that I can stop the LED blinking which I started when the missed call was registered at phonecalllog. Now, I cannot register the globateventlistener in optionprovider where I registered the phoneloglistener. I was trying to launch an application from the method calllogadded() so that I can register the globalevent listener in that application and close that application after I stop the led.
So, please help me out of this, How can I do so??
09-26-2009 12:12 PM
If I understand you correctly, your basic requirement is to turn off the LED's you have turned on.
I'm not sure why you want to do this using a GlobalEventListener. Can you explain why you think that is the best place? Is there some event that you are listening for?
Regardless, I believe there is very little overhead in starting an application that listens for GlobalEvents, and can therefore turn your LEDs off. So send this app a GlobalEvent from your listener to tell it that you have turned them on, then it can look after turning them off.