forked from upstream-mirrors/OpenTracks
Bluetooth: use TrackRecording handler for callback.
Otherwise the thread is not defined and a SecurityException may be triggered when inserting data into the ContentProvider. Sadly, below API26 this needs to be done manually. Fixes #1165.
This commit is contained in:
@@ -211,7 +211,7 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
|
||||
|
||||
private void startSensors() {
|
||||
wakeLock = SystemUtils.acquireWakeLock(this, wakeLock);
|
||||
trackPointCreator.start(this);
|
||||
trackPointCreator.start(this, handler);
|
||||
showNotification(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.dennisguse.opentracks.services.handlers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
@@ -48,12 +49,12 @@ public class TrackPointCreator implements BluetoothRemoteSensorManager.SensorDat
|
||||
this.gpsHandler = gpsHandler;
|
||||
}
|
||||
|
||||
public synchronized void start(@NonNull Context context) {
|
||||
public synchronized void start(@NonNull Context context, @NonNull Handler handler) {
|
||||
this.context = context;
|
||||
|
||||
gpsHandler.onStart(context);
|
||||
|
||||
remoteSensorManager = new BluetoothRemoteSensorManager(context, this);
|
||||
remoteSensorManager = new BluetoothRemoteSensorManager(context, handler, this);
|
||||
altitudeSumManager = new AltitudeSumManager();
|
||||
|
||||
remoteSensorManager.start();
|
||||
|
||||
Reference in New Issue
Block a user