Merge branch 'fix-bg' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
d87a08a9e8
@ -10,7 +10,7 @@ android {
|
||||
applicationId "com.uam.wmi.findmytutor"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 42
|
||||
versionCode 50
|
||||
versionName "1.0.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
@ -199,6 +199,8 @@ public abstract class BaseActivity
|
||||
}
|
||||
|
||||
public void stopBackgroundLocalizationTask() {
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), false);
|
||||
|
||||
Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
stopIntent.putExtra("request_stop", true);
|
||||
|
||||
@ -208,6 +210,7 @@ public abstract class BaseActivity
|
||||
|
||||
public void startBackgroundLocalizationTask() {
|
||||
checkPermissions();
|
||||
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), true);
|
||||
|
||||
Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
|
||||
startIntent.putExtra("notify_interval", onlineBackgroundLocationInterval);
|
||||
|
@ -207,7 +207,8 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere
|
||||
|
||||
/** Sharing level list **/
|
||||
locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
((MapActivity) getActivity()).handleBackgroundTaskLifeCycle();
|
||||
((MapActivity) getActivity()).stopBackgroundLocalizationTask();
|
||||
((MapActivity) getActivity()).startBackgroundLocalizationTask();
|
||||
PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue)));
|
||||
|
||||
if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {
|
||||
|
@ -168,7 +168,7 @@ public class BackgroundLocalizationService extends Service {
|
||||
if (saveMode != 0) {
|
||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
} else {
|
||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
|
||||
mLocationRequest.setPriority(LocationRequest.PRIORITY_LOW_POWER);
|
||||
}
|
||||
|
||||
mLocationRequest.setFastestInterval(notify_interval);
|
||||
@ -293,7 +293,7 @@ public class BackgroundLocalizationService extends Service {
|
||||
latitude = location.getLatitude();
|
||||
longitude = location.getLongitude();
|
||||
altitude = location.getAltitude();
|
||||
|
||||
Log.e(TAG,"TASK" + latitude + " " + longitude);
|
||||
approximatedLocalization = new ApproximatedLocalization(MapUtils.loadJsonFromAsset(getApplicationContext(), "building.geojson"));
|
||||
approximatedBuildingPart = approximatedLocalization.getNameOfBuildingPart(Point.fromLngLat(longitude, latitude));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user