Allow starting the Dashboard API automatically from the StartRecording API

Fixes #1116.
This commit is contained in:
Arjan Schrijver
2022-02-08 10:38:46 +01:00
committed by Dennis Guse
parent 7ca6925e7d
commit 1e4e7b8c15
13 changed files with 129 additions and 21 deletions
@@ -1,11 +1,25 @@
package de.dennisguse.opentracks.publicapi;
import android.os.Bundle;
import de.dennisguse.opentracks.data.models.Track;
import de.dennisguse.opentracks.services.TrackRecordingService;
import de.dennisguse.opentracks.settings.PreferencesUtils;
import de.dennisguse.opentracks.util.IntentDashboardUtils;
public class StartRecording extends AbstractAPIActivity {
private static final String TAG = StartRecording.class.getSimpleName();
protected void execute(TrackRecordingService service) {
service.startNewTrack();
Track.Id trackId = service.startNewTrack();
if ((trackId != null) && (PreferencesUtils.isPublicAPIDashboardEnabled())) {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
String targetPackage = bundle.getString("STATS_TARGET_PACKAGE", null);
String targetClass = bundle.getString("STATS_TARGET_CLASS", null);
IntentDashboardUtils.startDashboard(this, true, targetPackage, targetClass, trackId);
}
}
}
@Override