04-16-2013 08:38 PM
Once user clicks power button to turn off screen, location updates stop even though the activity is still listening for location upates. Then when screen is on again, the updates start back up.
This is different than every other Android device in the world.
Someone please verify I'm not going crazy.
04-19-2013 10:20 AM
04-20-2013 09:03 AM
04-22-2013 02:56 PM - edited 04-22-2013 02:59 PM
Android's location manager uses the native geolocation API for its implementation. By default, all clients using the geolocation API run with background mode disabled (and there's an API to enable it / disable it).
What Android does is it will enable background mode if it detects
a) A non-system Android application using the location manager
b) A non-system Android application having a partial wake lock held
Otherwise it will disable background mode, and so that's why you may see no updates when the screen goes off.
Now, if you hold a partial wake lock and you're not seeing updates, then there's a potential bug.
04-22-2013 03:39 PM
04-22-2013 03:56 PM
On a real Android device, you will continue to receive location updates as long as the device doesn't sleep, and you can prevent sleep by acquiring a partial wake lock. There is no background mode for Android's location manager because it's implied via the wake lock semantics.
Since we have to use BB10's native location manager to implement Android's location manager, we have to conform to its API.
The integration works like this
Android App 1 |
Android App 2 | --- talks to ----> Android Location Manager --- talks to ----> BB10 Location Manager
Android App n |
Android apps are clients to Android's location manager, and Android's location manager is a client to the BB10 location manager.
What we don't want to do is enable background mode in Android's location manager always, because that has poor battery life implications. So we use the fact that an app has a wake lock as a hint that we should turn on background mode.
Also what is this other potential BB10 bug?
04-22-2013 04:13 PM
04-22-2013 04:35 PM
By sleep I mean the CPU goes to sleep. If there is no PARTIAL_WAKE_LOCK held, an Android device will eventually enter sleep until there's an interupt that's causes it wake it up. If you hold a PARTIAL_WAKE_LOCK you indicate to the system that the CPU should not sleep for the duration that the lock is held.
Holding PARTIAL_WAKE_LOCKS indefinitely or for long periods of time has severe battery life implications. You should evaluate how necessary it is to have GPS updates when the user turns the screen off.
A SCREEN_BRIGHT_WAKELOCK / SCREEN_DIM_WAKELOCK is not quite the same as a PARTIAL_WAKE_LOCK. They keep the screen on (to varying degrees, which also has battery life implications), but the user can override it by pressing the power button. These wake locks as documented do not keep the CPU on and so the device can eventually sleep.
04-22-2013 04:51 PM