I did the following but it not work for always.It works if i launch the app manually and then turn off the device and turn on the device my app is launched. But before turning off the device if i switched to another app then after switch-on the device,”My app is not getting launch”.
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.ui.UiApplication;
public class MyApp extends UiApplication
{
public static void main(String args[]) {
if (args.length == 0)
{
ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();
current.setPowerOnBehavior(ApplicationDescriptor.POWER_ON);
ApplicationManager manager = ApplicationManager.getApplicationManager();
manager.scheduleApplication(current, System.currentTimeMillis()
+ 2000, true);
}
System.out.println("restarted !");
MyApp app = new MyApp();
app.enterEventDispatcher();
}
public MyApp()
{
pushScreen(new MyScreen());
}
}
Please help..........it's important...and thanks a lot.
Im not a blackberry expert, but I develop for iOS and Android. The on/off switch or power button is hardly linked to the device, and the action performed when it’s pressed is written in the operating system, not in an application, I don’t think you’ll find an event listener for this button to be pressed, just imagine the security issues it could raise if an app could prevent the phone from turning off (or on …)