2

我使用此代码获取 gps 传感器数据。

mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 1, mlocListener);

为什么我的 gps 图标会不停地打开和关闭?

4

1 回答 1

0

2000 milliseconds is approximatley 0.0333333 seconds. In your code, you have requested for location updates every 0.0333333 seconds.

mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 1, mlocListener);

This means for that the GPS doesn't always have to be updating itself. Thats why the GPS icon continuously turns on and off.

于 2012-07-22T13:30:36.453 回答