Bugfix: Public API stop does not start service in foreground.

Fixes #1354.
This commit is contained in:
Dennis Guse
2022-08-17 18:34:42 +02:00
parent 3c95d8744d
commit 719bb981ec
2 changed files with 10 additions and 1 deletions
@@ -34,7 +34,7 @@ public abstract class AbstractAPIActivity extends AppCompatActivity {
if (PreferencesUtils.isPublicAPIenabled()) {
Log.i(TAG, "Received and trying to execute requested action.");
new TrackRecordingServiceConnection(serviceConnectedCallback)
.startAndBind(this, true);
.startAndBind(this, isStartServiceForeground());
} else {
Toast.makeText(this, getString(R.string.settings_public_api_disabled_toast), Toast.LENGTH_LONG).show();
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 boolean isPostExecuteStopService();
@@ -57,4 +57,9 @@ public class StartRecording extends AbstractAPIActivity {
protected boolean isPostExecuteStopService() {
return false;
}
@Override
protected boolean isStartServiceForeground() {
return true;
}
}