amit
amit

Reputation: 169

how to use global Event listener?

i want to communicate between two applications, whenever blackberry messenger is open then at that time my application can notified that,this blackberry messenger is started.

how could i do with the use of global event listener..

thanks a lot.

Upvotes: 2

Views: 2423

Answers (2)

Rakesh Soni
Rakesh Soni

Reputation: 10907

2 applications OR Background application and foreground application can communicated through GlobalEventListener

  • Implemented the GlobalEventListener interface

  • Register for global event using the below line

    addGlobalEventListener(instance of class which implement the GlobalEventListener );

  • From background application post the global events (for other application) using the below line

    ApplicationManager.getApplicationManager().postGlobalEvent(MainWindow.GUID);

Note : postGlobalEvent methods having the 4 overloaded versions So you can pass addition info as well if require

  • Following method of GlobalEventListener interface method will listen the global event

    public void eventOccurred(long guid, int data0, int data1, Object object0, Object object1)

see the links for more details

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/GlobalEventListener.html http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/Application.html#addGlobalEventListener%28net.rim.device.api.system.GlobalEventListener%29

Upvotes: 1

Related Questions