mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Added unregister in onPause
This commit is contained in:
parent
0d188d630c
commit
2742184489
2 changed files with 11 additions and 2 deletions
|
|
@ -39,14 +39,17 @@ public class GPSExtractor {
|
|||
}
|
||||
|
||||
protected void registerLocationManager() {
|
||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
criteria = new Criteria();
|
||||
provider = locationManager.getBestProvider(criteria, true);
|
||||
myLocationListener = new MyLocationListener();
|
||||
|
||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||
}
|
||||
|
||||
protected void unregisterLocationManager() {
|
||||
locationManager.removeUpdates(myLocationListener);
|
||||
}
|
||||
|
||||
//Extract GPS coords of image
|
||||
public String getCoords() {
|
||||
|
||||
|
|
|
|||
|
|
@ -244,6 +244,12 @@ public class ShareActivity
|
|||
imageObj.registerLocationManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
imageObj.unregisterLocationManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue