04-30-2010 10:04 AM
I try to launch my application on startup by selecting "Auto-run on startup" in BlackBerry Application Descriptor. I use also SystemListenerto detect system availability on startup. It works fine(application is launched) when I restart the phone by taking out battery.But when I turn on/off the device by pressing button(some kind of sleep mode I guess), application is not launched on startup.
Is there any way to launch the application ofter tunring off/on the device by button?
Thanks in advance
Solved! Go to Solution.
04-30-2010 10:39 AM
SystemListener.powerOn is invoked during a soft power up. You can add a SystemListener during auto-run processing, and then your System Listener methods will get invoked during soft power down and power up. Give it a try to figure out what actually goes on and decide what you want to do, before you start implementing this. Note also that RuntimeStore survives a soft power off - can be a useful place to put bits of data.
Yes I agree, this is more a standby (sleep) mode than power off.
04-30-2010 11:22 AM
Thanks for answer Peter
SystemListener.powerUp() is invoked when i do not close application before going to stanby mode. When I close it , application is not started with "Auto-run on startup" setting when going back from standby mode. only when device is restarted by taking out battery. Is it how it should work?
Is there any way how to start application on going back from standby mode, or do I have to have aplication with SystemListener always running in background that will launch my application after powerOn detected?
04-30-2010 11:40 AM
What you see is correct.
If you wish to detect soft power up, your Application must remain active in the background, so that the powerUp is detected. However if your application does currently exit (System.exit(..) on close, the SystemListener is lost.
But if your application is exiting when the user closes it, how does the user then restart it? ,Effectively the soft restart has returned your application into the same state it was in when the user powered down?
This statement is slightly incorrect:
"do I have to have application with SystemListener always running in background that will launch my application after powerOn detected"
SystemListener is a function of the Application. If the Application is closed, the SystemListener associated wit that Application is not going to be called. So the comment "will launch" is not correct, your application is already running.
10-08-2012 02:47 PM
On doing this, when I check the device logs, I get the following:
RuntimeException application already running in this process net_rim_cldc-10(4E68CC9F) ApplicationProcess appStarted 0x43A6 net_rim_cldc-9(4E68CC9F) Application <init> 0x3272 net_rim_cldc-15(4E68CC9F) UiApplication <init> 0x656E MyAppTest(5072CC65) TheMainClass <init> 0xED0 MyAppTest(5072CC65) TheMainClass powerUp 0xE9C net_rim_cldc-27(4E68CC9F) Events dispatchSystemEvent 0x29DC net_rim_cldc-9(4E68CC9F) Application <private> 0x26CF net_rim_cldc-9(4E68CC9F) Application processNextMessage 0x1C3A net_rim_cldc-9(4E68CC9F) Application enterEventDispatcher 0x1B61 MyAppTest(5072CC65) TheMainClass main 0xF64
What should I do to prevent this from happening?