关于位置
有一个位置距离更新 -> 即如果手机的位置变化超过X米,则发送更新,不要每5秒询问一次,如果您在移动车辆中,那么X米将很快过去,如果您正在步行,则永远不会移动超过3-5米的5秒钟 - 人们会抱怨您的应用程序耗尽他们的电池。
另外 - 只有当您的应用程序未运行时,服务才会继续运行,如果您启动它为粘性。否则,当您的应用程序从应用程序队列中销毁时,服务也将被销毁。
requestLocationUpdates(long minTime, float minDistance, Criteria criteria, PendingIntent intent)
Register for location updates using a Criteria and pending intent.
void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, LocationListener listener, Looper looper)
Register for location updates using a Criteria, and a callback on the specified looper thread.
void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)
Register for location updates using the named provider, and a pending intent.
void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener, Looper looper)
Register for location updates using the named provider, and a callback on the specified looper thread.
void requestLocationUpdates(String provider, long minTime, float minDistance, PendingIntent intent)
Register for location updates using the named provider, and a pending intent.
位置 API