Elmi
Elmi

Reputation: 6193

Android: keep GPS active during stand-by?

I have a Service that creates a wake-lock:

pm = (PowerManager) getSystemService(POWER_SERVICE);
flags=PowerManager.PARTIAL_WAKE_LOCK; 
wl = pm.newWakeLock(flags,"myApp");
wl.acquire();

Next I request location updates via LocationManager.GPS_PROVIDER. That works fine until the device goes to PARTIAL_WAKE_LOCK-sleep, here the GPS location dies. So my question: how can I GPS enable to stay alive during this kind of stand-by? Setting SCREEN_DIM_WAKE_LOCK would work but is not an option because it requires way too much power.

Elmi

Upvotes: 1

Views: 1267

Answers (1)

Elmi
Elmi

Reputation: 6193

What I found out meanwhile: it seems to be device- or operating system version dependent.

For my Motorola Xoom 2 / Android 3.2 it is possible to turn off the whole screen and the system including GPS stays alive with the partial wake lock.

For some other devices (reported by users of my app) that seems to stop GPS, they at maximum can dim the screen to keep it alive.

Upvotes: 1

Related Questions