My app uses the location, mapAdress and heading handlers (runtime:addevenlistener).
I’ve gone so far as to add code to turn them off and on during the system.notification events (startup/suspend/resume events) to make sure they are turned off when the app isn’t in the foreground. However, I’m noticing significant battery drain in certain circumstances. On a Samsung S3 running android 4.3:
Each time the app resumes, it re initializes the event handlers - however if the user suspends the app again (say, within 30 seconds), you can see the GPS icon in the status bar “blinking”. (The app also removes the handlers when suspend occurs).
Apparently, the OS GPS code/icon will blink while it is acquiring GPS coordinates - and will not quit once acquired. (It apparently does not quit immediately when the handlers are removed)
Once the icon stops blinking it remains solid – and ON. The battery drains very quickly when this happens, and resuming the app / suspending again will NOT turn the GPS off - it remains in this state permanently - until the app is “force quit” (which removes the icon immediately). Viewing the power use of the app in Android Settings while in this state also shows that the app is being tallied for using the GPS (while it is suspended).
I’m also looking at a “stay awake” battery issue / discrepancy on Nexus 7 tablets. It seems in some circumstances, the OS reported “stay awake” time has a similar issue. I’ll post again if I can consistently repeat the stay awake issue.