Over the last few months, I noticed that one of my apps, was searching for GPS long after the app was closed. I noticed that it usually happened in low-GPS areas and seemed intermittent.
After looking into the usual culprits – not calling
myLocationOverlay.disableMyLocation() or not calling
onPause(), I discovered a new problem I hadn’t seen/heard of before.
After some forensic debugging, I found this line of code:
FlurryAgent.onStartSession(this, "<Flurry API Key>");
I thought, there’s no way that Flurry is requesting location and not giving it up when the app is backgrounded, right?
After some digging in the API docs, I found:
static void setReportLocation (boolean reportLocation)
Set whether Flurry should include location information within its reports. Defaults to true.
Calling setReportLocation(false) fixed the leaking GPS issue (since I don’t care about location analytics on Flurry anyway.
Hope that helps someone!