Android的LocationListener的离开而手机睡着了 [英] Android LocationListener leave on while phone asleep

查看:130
本文介绍了Android的LocationListener的离开而手机睡着了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置所述标志RTC_WAKEUP报警运行​​IntentService每30秒位置更新传送给服务器。我打算标志更改为RTC,所以它不会醒了电话,就在另一个进程唤醒UPS手机上运行。如果我离开注册的LocationListener的,将仍然监听位置更新,而手机是睡着了?

I set an alarm with the flag RTC_WAKEUP to run a IntentService every 30 seconds to transmit location updates to a server. I'm planning to change the flag to RTC so it won't wake up the phone and just run when another process wake ups the phone. If I leave a LocationListener registered, will it still listen for location updates while the phone is asleep?

推荐答案

是 - 工作地点的服务有它自己的唤醒锁。但更好的方法是在你的广播接收器手动设置适当的唤醒锁。请考虑一些优化 - 发送的数据通过网络每隔30秒会耗尽电池

Yes - working location service has it's own wake lock. However better approach is manually set proper wake lock in your broadcast receiver. Please consider some optimization - sending data over network every 30s will drain battery.

这篇关于Android的LocationListener的离开而手机睡着了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆