If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
m-romanuik
Posts: 114
Registered: ‎04-28-2010
My Device: Storm 9530
My Carrier: Telus

Re: Open a screen from application at particular time, whether application is open or not.

[ Edited ]

try this algorithm instead:

 

public void pushScreenDate(long future){
	// Grab UiApplication and Pop LoadingScreen    
        UiApplication.getUiApplication().invokeLater(new Runnable() {
            public void run(){
                // Pop LoadingScreen
                UiApplication.getUiApplication().requestForeground();
            }}, _future, false);
}

public void onExit(long future){
	// Initialize ApplicationManager
	ApplicationManager manager = ApplicationManager.getApplicationManager();
	ApplicationDescriptor descriptors[] = manager.getVisibleApplications();

	// Initialize Variables (Find your app in here)
	String appname1 = descriptors[0].getName();

	// Schedule it for future date
	try{appmanager.scheduleApplication(newdescriptor, future, true);} 
	catch(ApplicationManagerException) {
	// Handle situation when application cannot run
	}
}

public void onFailure(){
	// Initialize ApplicationManager
	ApplicationManager manager = ApplicationManager.getApplicationManager();
	ApplicationDescriptor descriptors[] = manager.getVisibleApplications();

	// Initialize Variables (Find your app in here)
	String appname1 = descriptors[0].getName();
	long future = 3600000; // Next 24 Hour

	// Schedule it for future date
	try{appmanager.scheduleApplication(newdescriptor, future, false);} 
	catch(ApplicationManagerException) {
		// Handle situation when application cannot run
	}
}

 

 

EDIT: Added 'onExit'and 'onFailure'

 

onExit should be called when program is exiting and is no longer active.

onFailure should be called every 24 hours and 5 minutes to keep your program running if phone crashs.

 

Please use plain text.
Developer
m-romanuik
Posts: 114
Registered: ‎04-28-2010
My Device: Storm 9530
My Carrier: Telus

Re: Open a screen from application at particular time, whether application is open or not.

[ Edited ]

However I feel werid about the pushScreenDate solution only because if the program closes all the invokeLater commands disappear? I think you may have to either presiststore this instance of the program or keep a database of scheulde events and if the program closes or crashes.. on re-initialization (app loadup either by onExit, User, or onFailure) read the database and re-re-'invokeLater' the things you must schdule.

 

PS i love the re-re-'invokeLater'.

Please use plain text.
Trusted Contributor
hims_3009
Posts: 227
Registered: ‎12-16-2009
My Device: 9530,8900,9000
My Carrier: Airtel,Docomo

Re: Open a screen from application at particular time, whether application is open or not.

Is it Possible to get the Global Event for RepeatRule ?

can we change the gui display with the RepeatRule? It is very usefull if we can do these.

Lathiya Himanshu
Please use plain text.