Add settings to disable recording once app is killed
This commit is contained in:
parent
9366dd7d28
commit
a494d741ce
5 changed files with 23 additions and 2 deletions
|
@ -14,7 +14,6 @@
|
|||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
|
||||
<uses-permission android:name="android.permission.STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
@ -244,7 +243,8 @@
|
|||
<service
|
||||
android:process="net.osmand.plus"
|
||||
android:label="@string/process_navigation_service"
|
||||
android:name="net.osmand.plus.NavigationService">
|
||||
android:name="net.osmand.plus.NavigationService"
|
||||
android:stopWithTask="false">
|
||||
<intent-filter>
|
||||
<action android:name="net.osmand.plus.NavigationService" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="disable_recording_once_app_killed">Run in background</string>
|
||||
<string name="disable_recording_once_app_killed_descrp">Stops recording if the app is killed (via recent apps). When the app is started, the recording will start over (notification on the top about background process).</string>
|
||||
<string name="shared_string_import2osmand">Import to OsmAnd</string>
|
||||
<string name="read_full_article">Read full article</string>
|
||||
<string name="download_wikipedia_item">Wikipedia</string>
|
||||
|
|
|
@ -281,6 +281,21 @@ public class NavigationService extends Service implements LocationListener {
|
|||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(Intent rootIntent) {
|
||||
if (((OsmandApplication) getApplication()).getNavigationService() != null &&
|
||||
((OsmandApplication) getApplication()).getSettings().DISABLE_RECORDING_ONCE_APP_KILLED.get()) {
|
||||
OsMoPlugin plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
|
||||
if (plugin != null) {
|
||||
if (plugin.getTracker().isEnabledTracker()) {
|
||||
plugin.getTracker().disableTracker();
|
||||
}
|
||||
plugin.getService().disconnect();
|
||||
}
|
||||
NavigationService.this.stopSelf();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -834,6 +834,8 @@ public class OsmandSettings {
|
|||
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
|
||||
}
|
||||
|
||||
public final CommonPreference<Boolean> DISABLE_RECORDING_ONCE_APP_KILLED = new BooleanPreference("disable_recording_once_app_killed", false).makeGlobal();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
|
||||
// temporarily for new version
|
||||
|
|
|
@ -94,6 +94,8 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
|
|||
R.string.save_track_to_gpx_descrp));
|
||||
cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS,
|
||||
MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr));
|
||||
cat.addPreference(createCheckBoxPreference(settings.DISABLE_RECORDING_ONCE_APP_KILLED, R.string.disable_recording_once_app_killed,
|
||||
R.string.disable_recording_once_app_killed_descrp));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue