Skip to content

Location provider drains battery #8

@mvglasow

Description

@mvglasow

It appears that, once accessed, the location provider remains active in the background and drains the battery. I noticed the following:

I opened SatStat on my way to work (the satstat-location branch, which accesses the network location provider) and looked my position on the map for some time. Then I returned to the home screen and switched the screen off.

I briefly used my phone at work on a few occasions – no calls, just briefly checked my email once or twice – and noticed that the back of the phone felt warm to the touch, and the battery was draining quickly. When I went home, it was around 20%. Battery usage statistics showed Phone as the biggest consumer (72%), the second one being SatStat (11%).

I have checked the code of SatStat to rule out any errors there. SatStat registers with location providers in two places:

  • GpsEventReceiver registers with the passive location provider – this should not put any strain on resources as long as no other location provider is in use
  • MainActivity registers with the location providers selected by the user (in that case, I had selected GPS and network) in onResume() and releases them in onPause(). Since there is no way to selectively release a single location provider, all providers are released simultaneously.

As I returned from SatStat to the home screen, I noticed that the location notfication icon went away, indicating SatStat had released the GPS (and thus also the other location providers held by the MainActivity’s context).

This leads me to the suspicion that the location provider stays active even after it is released by all apps, when it should really cease all activity until it is needed again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions