mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
onResume() method for calling registerLocationManager
This commit is contained in:
parent
e5b746e411
commit
0d188d630c
2 changed files with 13 additions and 10 deletions
|
|
@ -38,12 +38,12 @@ public class GPSExtractor {
|
|||
return gpsPref;
|
||||
}
|
||||
|
||||
private void registerLocationManager() {
|
||||
protected void registerLocationManager() {
|
||||
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
criteria = new Criteria();
|
||||
provider = locationManager.getBestProvider(criteria, true);
|
||||
myLocationListener = new MyLocationListener();
|
||||
|
||||
|
||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public class ShareActivity
|
|||
implements SingleUploadFragment.OnUploadActionInitiated,
|
||||
CategorizationFragment.OnCategoriesSaveHandler {
|
||||
|
||||
private static final String TAG = ShareActivity.class.getName();
|
||||
|
||||
private SingleUploadFragment shareView;
|
||||
private CategorizationFragment categorizationFragment;
|
||||
|
||||
|
|
@ -44,17 +46,14 @@ public class ShareActivity
|
|||
private String mediaUriString;
|
||||
|
||||
private Uri mediaUri;
|
||||
|
||||
private Contribution contribution;
|
||||
|
||||
private ImageView backgroundImageView;
|
||||
|
||||
private UploadController uploadController;
|
||||
|
||||
private CommonsApplication cacheObj;
|
||||
private boolean cacheFound;
|
||||
|
||||
private static final String TAG = ShareActivity.class.getName();
|
||||
private GPSExtractor imageObj;
|
||||
|
||||
public ShareActivity() {
|
||||
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
|
||||
|
|
@ -197,11 +196,10 @@ public class ShareActivity
|
|||
String filePath = FileUtils.getPath(this, mediaUri);
|
||||
Log.d(TAG, "Filepath: " + filePath);
|
||||
|
||||
if (filePath != null && !filePath.equals("")) {
|
||||
//extract the coordinates of image in decimal degrees
|
||||
Log.d(TAG, "Calling GPSExtractor");
|
||||
GPSExtractor imageObj = new GPSExtractor(filePath, this);
|
||||
Log.d(TAG, "Calling GPSExtractor");
|
||||
imageObj = new GPSExtractor(filePath, this);
|
||||
|
||||
if (filePath != null && !filePath.equals("")) {
|
||||
//Gets image coords if exist, otherwise gets last known coords
|
||||
String decimalCoords = imageObj.getCoords();
|
||||
|
||||
|
|
@ -240,6 +238,11 @@ public class ShareActivity
|
|||
requestAuthToken();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
imageObj.registerLocationManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue