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
Posts: 658
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus
Accepted Solution

Global Events and Global Event Listeners doesn't work!!!

[ Edited ]

I do not know who to ask if I have question about knowledge base articles so I'm going to post it here.

 

I want to push alert dialog box like how integrated calendar alerts users. I understand that I need to make use of globalevents and listeners so I've been studying it from knowledge base article below:

 

http://supportforums.blackberry.com/t5/Java-Development/Global-Events-and-Global-Event-Listeners/ta-...

 

However, when I run the code, it does not do anything. The way it is set up, it should be displaying the messages ("event received, sending acknowledgement and acknowledgement received") but nothing happens on my simulator once I "fire" the global event. Please help!!!

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Global Events and Global Event Listeners doesn't work!!!

Post a sample of your code so we can see what you're doing wrong. Since you're saying it doesn't work (and only that), we can't determine why it doesn't.

 

Thanks.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 658
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

Re: Global Events and Global Event Listeners doesn't work!!!

The code I used is exactly same as the one from KB. I just copied and pasted it.

 

I don't know why the texts are not appearing since I've everything makes sense. If you build based on the codes from KB, does it work?

 

 

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Global Events and Global Event Listeners doesn't work!!!

Are you loading both applications to the simulator or device or just one?

 

Were they built as separate apps?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 658
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

Re: Global Events and Global Event Listeners doesn't work!!!

The two java classes are under one package com.samples.GlobalEventFiring and only one of the classes (GlobalEventFiring.java) pushes mainScreen so I just built that one onto simulator. Is it not how I'm suppose to build it?

 

I'm really a n00b developer so I need some assistance Smiley Sad

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Global Events and Global Event Listeners doesn't work!!!

[ Edited ]

No problem. We were all there at one point. 

 

Each one of those files has a main method which is your entry point to the application. Since each one has one, they both need to have their own projects.

 

So create a new project for each of those files in Eclipse (or JDE; Eclipse preferred) and drop the code in. then run both projects on the simulator. 

 

Once both applications are on the sim, you can then show the interaction between both applications.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 658
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

Re: Global Events and Global Event Listeners doesn't work!!!

Thank you!!

 

By the way, is there any way for the app to be not running and still listen in and catch the global event?

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Global Events and Global Event Listeners doesn't work!!!

No. At least one instance of your application has to be running to receive events. The good thing is that you can run your applications in the background on startup so its always aware of new events.
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Developer
Posts: 658
Registered: ‎10-08-2009
My Device: Bold 9900
My Carrier: Telus

Re: Global Events and Global Event Listeners doesn't work!!!

If an instance is always running, wouldn't that have huge impact on batter life? Is that how all the other apps do it? Have the app run on background?

----------------------------------------------------------
Twitter: @gyubok
Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Global Events and Global Event Listeners doesn't work!!!

Most popular apps, in one way or another, run in the background. Battery life depends on what you're actually doing in the background.

If you're doing lots of data pulls from a server or accessing GPS, turning the screen on and off, etc. , these things generally have a negative impact.
Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful