Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - When using LocationManager.requestLocationUpdates, do I need a WakeLock?

My app periodically checks the location using an alarm to a BroastcastReceiver that starts a service. I know I should acquire a wakelock before I start the service but my question is when can I release it?

If I release the wakelock after calling requestLocationUpdates, can the device go to sleep and not call my LocationListener or will the device always wake to deliver updates and stay awake until the callback has returned? I'm reluctant to hold onto the wakelock because that would prevent the device from sleeping between updates until I'm done with the location.

like image 731
noah Avatar asked Sep 28 '10 16:09

noah


1 Answers

So based on my experience (and confirmed in the comments here), releasing the wake lock after after calling requestLocationUpdates doesn't seem to be a problem. Unfortunately, the only way to get a definitive answer is to ask a platform developer, but I've received no response.

like image 137
2 revs, 2 users 80% Avatar answered Oct 20 '22 01:10

2 revs, 2 users 80%