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: 132
Registered: ‎10-25-2011
My Device: Tour 9630
My Carrier: MTN

Re: Alternate entry point and applicationmanager.scheduleapplication

Thanks peter , im quite a newbie in bb development tops 3 months interval , i learn as i proceed , i must confess your knowledge has been very inspirational to me , i thank you once again , this is what i did , u can highlight me on bottlenecks and optimization techniques , so far it works  well .

this is my main method 

public static void main( String[] args)
{

if ( args != null && args.length > 0 && args[0].equals("autoboot"))
{
//background process
// waiting a while to ensure boot process
while(ApplicationManager.getApplicationManager().inStartup())
{
try
{
Thread.sleep(5000);
}
catch (Throwable error)
{
Logger.error("Launcher while app in start up"+ error.getMessage());
}
}
final Launcher launcher = new Launcher();
launcher.invokeLater(new Runnable()
{
public void run()
{
// confirm start up procedure is done
if(ApplicationManager.getApplicationManager().inStartup())
{

// initiate power up
launcher.addSystemListener(launcher);

// initiate when file system  sdcard is mounted i basically copy dbfile to sdcard
launcher.addFileSystemListener(launcher);
}
else
{// copy the db to sdcard procedure
launcher.doStartupWorkLater();
// start the timer procedure that starts the thread 
launcher.startMessageFetcher(launcher);

}
}});

launcher.enterEventDispatcher();


}
else
{
// home icon clicked launch gui
LaunchUI ui = new LaunchUI();
ui.enterEventDispatcher();

}

}

Highlighted
Developer
Posts: 19,633
Registered: ‎07-14-2008
My Device: Not Specified

Re: Alternate entry point and applicationmanager.scheduleapplication

This code makes no sense to me in your invokeLater

 

"if(ApplicationManager.getApplicationManager().inStartup())"

 

You will NOT be in startup at that point, so will always do the else. 

 

I have no idea why would would want a FileSystemListener in one case and not in the other either.

 

Debug this on the SImulator when it starts up and watch what happens...