2

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.

JoseK
  • 31,141
  • 14
  • 104
  • 131
amit
  • 169
  • 1
  • 11

2 Answers2

1

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

Rakesh Soni
  • 10,135
  • 5
  • 44
  • 51
1

Have you read this primer here

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is_-_Global_Events_and_Global_Event_Listeners.html?nodeid=800527&vernum=0

JoseK
  • 31,141
  • 14
  • 104
  • 131