【发布时间】:2016-09-02 20:12:54
【问题描述】:
我使用了LocationListener 的onLocationChanged 方法来检测我的设备位置的变化。在requestLocationUpdates 方法中,我设置了最小时间= 5 秒和最小距离= 2 米,但requestLocationUpdates 方法即使我的设备根本没有移动(静止放置)也会给我更新。那么请告诉我的代码有什么问题?
这是我的代码:
public class LocationDetector implements LocationListener {
@Override
public void onLocationChanged(Location location) {
Log.d("GPS: ",location.getLatitude()+", "+location.getLongitude());
}
.
LocationManager manager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
.
manager.requestLocationUpdates("gps", 5000, 2, new LocationDetector());
【问题讨论】:
标签: android android-gps