I am trying to determine if an Android user has had a close proximity to a list of predetermined locations. I'd like to do this with the least amount of drain on the phone's battery. The two mechanisms I see for accomplishing this are proximity alerts and requesting location updates. What are the pros and cons of the two methods? Will one have less affect on the battery than the other? In either case I would guess the specific location manager used would have some affect power usage (existing Stack Overflow answer).
问问题
840 次
1 回答
7
在电池使用方面,位置更新可能比接近警报便宜。
由于addProximityAlert
同时使用NETWORK_PROVIDER
和GPS_PROVIDER
,因此您无法选择要使用的提供程序。此外,虽然文档建议它在屏幕关闭时将接近检查限制为每四分钟一次,但我找不到支持此类功能的代码,而我能找到的基本上是一个调用,requestLocationUpdates
具有最小时间间隔提示1000 毫秒。 由于建议后台服务使用超过 60000 毫秒的值,我怀疑直接调用requestLocationUpdates
具有较大的最小时间间隔和NETWORK_PROVIDER
.
于 2010-06-14T06:32:54.117 回答