forked from upstream-mirrors/OpenTracks
Bugfix: Public API stop does not start service in foreground.
Fixes #1354.
This commit is contained in:
@@ -34,7 +34,7 @@ public abstract class AbstractAPIActivity extends AppCompatActivity {
|
|||||||
if (PreferencesUtils.isPublicAPIenabled()) {
|
if (PreferencesUtils.isPublicAPIenabled()) {
|
||||||
Log.i(TAG, "Received and trying to execute requested action.");
|
Log.i(TAG, "Received and trying to execute requested action.");
|
||||||
new TrackRecordingServiceConnection(serviceConnectedCallback)
|
new TrackRecordingServiceConnection(serviceConnectedCallback)
|
||||||
.startAndBind(this, true);
|
.startAndBind(this, isStartServiceForeground());
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, getString(R.string.settings_public_api_disabled_toast), Toast.LENGTH_LONG).show();
|
Toast.makeText(this, getString(R.string.settings_public_api_disabled_toast), Toast.LENGTH_LONG).show();
|
||||||
Log.w(TAG, "Public API is disabled; ignoring request.");
|
Log.w(TAG, "Public API is disabled; ignoring request.");
|
||||||
@@ -42,6 +42,10 @@ public abstract class AbstractAPIActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isStartServiceForeground() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void execute(TrackRecordingService service);
|
protected abstract void execute(TrackRecordingService service);
|
||||||
|
|
||||||
protected abstract boolean isPostExecuteStopService();
|
protected abstract boolean isPostExecuteStopService();
|
||||||
|
|||||||
@@ -57,4 +57,9 @@ public class StartRecording extends AbstractAPIActivity {
|
|||||||
protected boolean isPostExecuteStopService() {
|
protected boolean isPostExecuteStopService() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isStartServiceForeground() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user