Android的 - 当使用LocationManager.requestLocationUpdates,我需要一个WakeLock?LocationManager、Android、WakeLock、

由网友(雅痞紳士)分享简介:我的应用程序会定期检查使用报警到 BroastcastReceiver 启动一个服务的位置。我知道我应该获得一个wakelock开始之前,我的服务,但我什么时候可以释放我的问题是? My app periodically checks the location using an alarm to a Broastca...

我的应用程序会定期检查使用报警到 BroastcastReceiver 启动一个服务的位置。我知道我应该获得一个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?

如果我打电话后释放wakelock requestLocationUpdates ,可以将设备进入睡眠状态,而不是叫我 LocationListener的或将设备总是醒,提供更新,并保持清醒,直到回调返回?我不愿意守住wakelock,因为这将prevent设备的更新,睡,直到我的位置做了。

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.

推荐答案

所以,根据我的经验,释放唤醒锁后调用后 requestLocationUpdates 似乎并没有被一个问题。不幸的是,得到一个明确的答案的唯一方法就是问一个平台的开发者,但我已经收到没有回应。

So based on my experience, 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.

阅读全文

相关推荐

最新文章