04-22-2013 06:32 PM
04-23-2013 10:28 AM
That excessive wake lock warning and subsequent termination of your process is something that's baked into Android. You definitely don't want to hold a partial wake lock indefinitely, so much so that Android attempts to curb your attempts to do so.
I will have to dig into this a bit more.
04-23-2013 10:44 AM
Ok, but you see the delima right?
As of right now BB10 offers no way to get Location Updates if the screen is off ( except for 15 minutes after which app is terminated). So I might be able to use the 15 minute window (if that is fixed) to get location updates during that time, then release the wake lock at minute 14 or something so the app doesn't get killed.
BB10 needs a way for Android apps to get location updates if user turns off the screen. Many use cases for this and it works without special handling or partial wake lock on other Android devices.
Think of any Geo Caching or Navigation app, or my golf app. People keep the app open for long periods of time but want to conserve battery power and prevent button clicks with phone in their pocket, so they click power button to lock the screen. They want the app to keep getting location updates especially so that it doesn't have to re-acquire a satellite lock everytime the app is opened. It's a major feature of Andoid (not to mention iOS) that this is possible and is what has led to the success of those platforms.
I'm still hoping you can come up with some magic workaround but if not please open a defect ASAP. We need a way to do this.
04-23-2013 10:53 AM
There is no work around besides the partial wake lock that I mentioned.
I'm still not convinced that the way that it's implemented now is incorrect (althought it might be a tad undiscoverable). But if it's incorrect then surely it could be addressed.
Can you point me to some Android documentation that states that the GPS / CPU will remain on indefinitely as long as you have an active listener?
Does your app work as you intend if you turn all other radios off (my best guess at what might keep the CPU awake).
04-23-2013 11:29 AM
I'll search for some official documentation, it may not be spelled out exactly though. However I know this:
On all other Android devices, onPause not onStop is called when user clicks power button or screen times out. On BB10 onStop is called. On other devices onStop might eventually get called if device is low on resources, but this rarely happens.
On other devices Activity will continue to receive location updates for long period of time (30 minutes or more) while activity is paused (screen is off). Not the case on BB10, where location updates stop immediately.
BB10 doesn't allow the use of Android Service so can't use that to run in the background either.
So essentially no way for a BB10 Android app to do anything with locations while screen is off (with the exception of the 15 minute window). This is untrue for all other Android devices. So really hampers what you can do on BB10 from an Android perspective.
04-23-2013 11:33 AM
BB10 does allow you to use Android Services. It may be terminated when your app window is closed, but you can still use them (and certainly should use them)
04-23-2013 11:42 AM - edited 04-23-2013 11:42 AM
If LocationManager is essentially shutdown when user clicks the power button, then does it matter if I can use a service?
The key here I think is that BB10 is shutting down Android's LocationManager when the power button is clicked. So doing anything via a service or anything that executes in the background will just get old data or none at all by using LocationManager (right?) and LocationManager will not send any updates to anything that requested location updates while screen is off.
So sorry, I don't want to side track the thread here. Let's keep it on receiving GPS updates (in any way) while screen is off. Is that possible (aside from the wake lock approach)?