LocationManager calling onLocationChanged too often?

后端 未结 3 683
借酒劲吻你
借酒劲吻你 2021-02-03 12:14

I\'ve set up the LocationManager to get the current location every 2 minutes:

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 120000, 0, thi         


        
3条回答
  •  没有蜡笔的小新
    2021-02-03 13:00

    From the documentation of requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener) concering the minTime parameter:

    "the minimum time interval for notifications, in milliseconds. This field is only used as a hint to conserve power, and actual time between location updates may be greater or lesser than this value."

    So the answer to your questions, yes this is standard behavior and, no you cannot change this.

    If this is a problem for you, you could ignore calls to the callback method if a certain amount of time hasn't passed.

提交回复
热议问题