Report foreground location errors
This commit is contained in:
parent
e7cce01ca9
commit
17ec73b176
@ -108,6 +108,7 @@ class LocationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateDeviceLocation() async {
|
updateDeviceLocation() async {
|
||||||
|
try {
|
||||||
Logger.d("[Foreground location] Started");
|
Logger.d("[Foreground location] Started");
|
||||||
Geolocator geolocator = Geolocator();
|
Geolocator geolocator = Geolocator();
|
||||||
var battery = Battery();
|
var battery = Battery();
|
||||||
@ -133,16 +134,22 @@ class LocationManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Logger.d("[Foreground location] Sending data home...");
|
Logger.d("[Foreground location] Sending data home...");
|
||||||
var response = await http.post(
|
http.Response response = await http.post(
|
||||||
url,
|
url,
|
||||||
headers: {"Content-Type": "application/json"},
|
headers: {"Content-Type": "application/json"},
|
||||||
body: json.encode(data)
|
body: json.encode(data)
|
||||||
);
|
);
|
||||||
|
if (response.statusCode >= 300) {
|
||||||
|
Logger.e('Foreground location update error: ${response.body}');
|
||||||
|
}
|
||||||
Logger.d("[Foreground location] Got HTTP ${response.statusCode}");
|
Logger.d("[Foreground location] Got HTTP ${response.statusCode}");
|
||||||
} else {
|
} else {
|
||||||
Logger.d("[Foreground location] No location. Aborting.");
|
Logger.d("[Foreground location] No location. Aborting.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e, stack) {
|
||||||
|
Logger.e('Foreground location error: ${e.toSTring()}', stacktrace: stack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user