diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2e32ae2..fb52479 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,10 +4,10 @@ package="com.uam.wmi.findmytutor"> + - diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java index 4183098..d7eb01c 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java @@ -212,7 +212,7 @@ public abstract class BaseActivity Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class); startIntent.putExtra("notify_interval", onlineBackgroundLocationInterval); - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(startIntent); } else { startService(startIntent); diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java index 5e900e7..5c161d5 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java @@ -214,8 +214,7 @@ public class SharingFragment extends PreferenceFragment implements SharedPrefere /** Sharing level list **/ locationMode.setOnPreferenceChangeListener((preference, newValue) -> { - ((MapActivity) getActivity()).stopBackgroundLocalizationTask(); - ((MapActivity) getActivity()).startBackgroundLocalizationTask(); + ((MapActivity) getActivity()).handleBackgroundTaskLifeCycle(); PrefUtils.storeLocationMode(getApplicationContext(), locationLevelMapping.get(Integer.parseInt((String) newValue))); if (PrefUtils.getLocationLevel(getApplicationContext()).equals(SharingLevel.MANUAL.toString())) {