I have a problem with my service that implemented LocationListener getting GPSupdate every 500 ms. No matter what minTime I add to the requestLocationUpdates function.
Part of my code:
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" );
}
}
From the button in my main activity, I will call startService (), after which it should work in the background, but it gives continuous updates.
source
share