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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 554
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor

Background listener to Global events

I found the sample code for this. How do I change it so it is always starts and always run in the background?

 

Here is the sample code I found (dont need the ack back but kept while testing)

 

package com.samples.eventFiring;

import net.rim.blackberry.api.mail.*;

import net.rim.blackberry.api.mail.event.*;

import net.rim.device.api.system.*;

import net.rim.device.api.ui.*;

import net.rim.device.api.ui.component.*;

import net.rim.device.api.ui.container.*;

class GlobalEventListening extends UiApplication implements GlobalEventListener

{

private MainScreen mainScreen;

public static void main(String args[])

{

GlobalEventListening theApp = new GlobalEventListening();

theApp.enterEventDispatcher();

}

public GlobalEventListening()

{

addGlobalEventListener(this);

}

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

{

if (guid == 0xba4b84944bb7429eL)

{

System.out.println("Event received, sending acknowledgment...");

ApplicationManager.getApplicationManager().postGlobalEvent(0x7d3a74a5ccfe6483L);

}

}

}

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Background listener to Global events

Set Project Property "Auto-start" to get it to always start.

 

You could change the UiApplication to just Application, mark it as a System Module, then you will never see it and there will be no icon. 

 

Is that what you want?

Developer
Posts: 554
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor

Re: Background listener to Global events

Basically yes,

 

thanks Peter.  Will test tomorrow

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-