Background location tracking crash reporting
This commit is contained in:
parent
1a9fec8b98
commit
8d1b728194
@ -150,6 +150,7 @@ class LocationManager {
|
|||||||
void updateDeviceLocationIsolate() {
|
void updateDeviceLocationIsolate() {
|
||||||
workManager.Workmanager.executeTask((backgroundTask, data) {
|
workManager.Workmanager.executeTask((backgroundTask, data) {
|
||||||
print("[Background $backgroundTask] Started");
|
print("[Background $backgroundTask] Started");
|
||||||
|
final SentryClient sentryClient = SentryClient(dsn: "https://5c868e5ef26947e2b61b189e391ec31b@sentry.io/1836366");
|
||||||
Geolocator geolocator = Geolocator();
|
Geolocator geolocator = Geolocator();
|
||||||
var battery = Battery();
|
var battery = Battery();
|
||||||
int batteryLevel = 100;
|
int batteryLevel = 100;
|
||||||
@ -183,9 +184,13 @@ void updateDeviceLocationIsolate() {
|
|||||||
body: json.encode(data)
|
body: json.encode(data)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print("[Background $backgroundTask] No location. Finishing.");
|
throw "Can't get device location. Location is null";
|
||||||
}
|
}
|
||||||
}).catchError((e) {
|
}).catchError((e) {
|
||||||
|
sentryClient.captureException(
|
||||||
|
exception: "Error tracking location",
|
||||||
|
stackTrace: "${e.toString()}",
|
||||||
|
);
|
||||||
print("[Background $backgroundTask] Error getting current location: ${e.toString()}");
|
print("[Background $backgroundTask] Error getting current location: ${e.toString()}");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user