Trackbook tries to restart recording after it has been killed the operating system

This commit is contained in:
y20k 2018-04-16 17:00:27 +02:00
parent ca8ad1febf
commit 962275f04b
2 changed files with 18 additions and 4 deletions

View file

@ -130,8 +130,15 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// SERVICE RESTART (via START_STICKY)
if (intent == null) {
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREFS_TRACKER_SERVICE_RUNNING, false)) {
LogHelper.w(LOG_TAG, "Trackbook has been killed by the operating system. Trying to resume recording.");
resumeTracking(LocationHelper.determineLastKnownLocation(mLocationManager));
}
}
// ACTION STOP
if (ACTION_STOP.equals(intent.getAction())) {
else if (ACTION_STOP.equals(intent.getAction())) {
stopTracking();
}
// ACTION RESUME
@ -144,6 +151,13 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
}
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
LogHelper.v(LOG_TAG, "onTaskRemoved called.");
}
@Override
public void onDestroy() {
LogHelper.v(LOG_TAG, "onDestroy called.");

View file

@ -20,13 +20,13 @@ allprojects {
}
project.ext {
applicationId = 'org.y20k.trackbook'
versionCode = 23
versionName = '1.1.7'
versionCode = 24
versionName = '1.1.8'
minSdkVersion = 22
compileSdkVersion = 27
targetSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibraryVersion = '27.1.0'
supportLibraryVersion = '27.1.1'
constraintLayoutVersion = '1.1.0-beta5'
osmdroidVersion = '6.0.1'