Android How To Stop Gps
After launching listener by the following code is working fine. LocationManager locationManager =(LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.reque
Solution 1:
You need to pass the same object implementing LocationListener that you requested location updates for to the locationManager.removeUpdates() method.
So in unless this
and gpsl
are one and the same, you should call:
locationManager.removeUpdates(gpsl);
Solution 2:
If you are using maps, you have to do:
locationManager.removeUpdates(locationListener);
mMap.setMylocationEnabled(false);
Solution 3:
You could pass the parameter like this GPSLocationListener.this
locationManager.removeGpsStatusListener(GPSLocationListener.this);
the compile will not be wrong
Solution 4:
My listener implemention
publicclassGPSLocationListenerextendsActivityimplementsLocationListener {
@OverridepublicvoidonLocationChanged(Location location) {
//code here
}
}
when i try to remove listener using follwing code compile time error.
locationManager.removeGpsStatusListener(GPSLocationListener )
Solution 5:
You have to pass the instance to your GPSLocationListener
go the removeGpsStatusListener
method and not the class name.
Post a Comment for "Android How To Stop Gps"