Im trying to port an android app to BB and Im having some issues with a few things. First off, when this app starts it creates a service that listens for certain events whether the application is in foreground or background. If the service is killed, I want it to automatically restart. here is my code for this in the service itself:
public int onStartCommand(Intent intent, int flags, int startId) { // Other code here...
// this will restart service if killed.
return START_STICKY
}
This works as expected in Android, but will not restart the service on BB. Has anyone experienced this?
Second off, I am trying relaunch an activity if the device is turned off. Therefore, I have created a wake lock to turn the screen on, and then I disable the keyguard and finally launch the activity. Unfortunately, I cannot disable the keyguard. My code to disable keyguard is below, has anyone experienced this?
KeyguardManager Keylockmgr = (KeyguardManager)getSystemService(KEYGUARD_SERVICE); Keylockmgr.newKeyguardLock("My Tag").disableKeyguard();
Any help would be greatly appreciated !!
This works as expected in Android, but will not restart the service on BB. Has anyone experienced this?
Quoting the BlackBerry documentation:
Background service: Apps can run services only while the user runs them, either in full screen or in thumbnail mode.
Now, I'm a bit hazy on "thumbnail mode", but my interpretation of this is that START_STICKY
will be ignored.
Unfortunately, I cannot disable the keyguard
According to the BlackBerry documentation, DISABLE_KEYGUARD
is not supported.