5
我有問題,我的服務,實現了LocationListener,每500毫秒似乎收到一個GPSupdate。無論我把什麼minTime放在requestLocationUpdates函數中。requestLocationUpdates不會更新間隔Android
我的一段代碼:
public class LocationService extends Service implements LocationListener {
LocationManager locMan;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
locMan = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locMan.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER;
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 1, this);
}
public void onLocationChanged(Location location) {
Log.d("Loc", "Location has been changed");
}
}
從一個按鈕,在我的主要活動我會打電話給startService(),在此之後它應該在後臺運行,但它提供了持續的更新。