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
anildeveloper
Posts: 33
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

watch ServiceBook changes with a Listener

Is there any Listener (like folderlistener, messagelistener, etc...) which notifies my applications, when there are any changes in the servicebook?

I already played with the ServiceRoutingListener, but this doesn't seem to be the right solution.

If not, what can I do as a workaround?

 

Regards and Thanks for Help Anil

Please use plain text.
Developer
peter_strange
Posts: 19,602
Registered: ‎07-14-2008
My Device: Not Specified

Re: watch ServiceBook changes with a Listener

GlobalEventListener.

//////////////////////////////////////////////////////////// /// GlobalEventListener Interface Implementation /// //////////////////////////////////////////////////////////// /** * Invoked when the specified global event occured. * The eventOccurred method provides two object parameters and two integer parameters for supplying details about the event itself. The developer determines how the parameters will be used. * * For example, if the event corresponded to sending or receiving a mail message, the object0 parameter might specify the mail message itself, while the data0 parameter might specify the identification details of the message, such as an address value. * * @param guid - The GUID of the event. * @param data0 - Integer value specifying information associated with the event. * @param data1 - Integer value specifying information associated with the event. * @param object0 - Object specifying information associated with the event. * @param object1 - Object specifying information associated with the event. */ public void eventOccurred(long guid, int data0, int data1, Object object0, Object object1) { if( guid == ServiceBook.GUID_SB_ADDED || guid == ServiceBook.GUID_SB_CHANGED || guid == ServiceBook.GUID_SB_OTA_SWITCH || guid == ServiceBook.GUID_SB_OTA_UPDATE || guid == ServiceBook.GUID_SB_POLICY_CHANGED || guid == ServiceBook.GUID_SB_REMOVED ) { // your code here; } }

 

 

Here is some sample code:

 

 

Please use plain text.
Developer
anildeveloper
Posts: 33
Registered: ‎07-16-2008
My Device: Not Specified

Re: watch ServiceBook changes with a Listener

Hello Peter!

 

Works good, thanks. I didn't read the sentence in the rim-api-docu at net.rim.device.api.servicebook.ServiceBook:

It is possible to listen for service book events through the globalEventListener interface (refer to the GUID_* events).

Regards from Austria

Anil

 

Please use plain text.