1

一旦设备开始移动,我想开始 gps 更新:

locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);

一旦设备停止,我想停止 gps 更新。

locationManager.removeUpdates(locationListener);

我该怎么做?什么最好的方法?

4

1 回答 1

0

在创建LocationRequest对象时添加setSmallestDisplacement(10),其中10米是设备为获取位置更新而必须行进的最小位移。

于 2017-12-09T05:19:42.727 回答