I believe there still could be delays when Android goes into deep sleep mode. On some devices there's an option to "not optimize" some apps for battery usage. For some reason can't find that setting on my Pixel 8, but I'm sure it's there somewhere.
On your Pixel 8 Pro, you can manage battery optimization settings for individual apps through the following steps:
Anton, I was reviewing the documentation you sent. Very interesting. Still trying to address the course logging...
Two questions:
BackgroundGeolocation.onActivityChange((ActivityChangeEvent event) {
String type = event.activity; // e.g. 'still', 'on_foot', 'in_vehicle'
print('[ActivityChange] $type');
if (type == 'still') {
BackgroundGeolocation.setConfig(Config(
distanceFilter: 100,
locationUpdateInterval: 15000,
fastestLocationUpdateInterval: 10000
));
} else if (type == 'walking' || type == 'on_foot') {
BackgroundGeolocation.setConfig(Config(
distanceFilter: 10,
locationUpdateInterval: 5000,
fastestLocationUpdateInterval: 2000
));
} else if (type == 'running') {
BackgroundGeolocation.setConfig(Config(
distanceFilter: 20,
locationUpdateInterval: 3000,
fastestLocationUpdateInterval: 1500
));
} else if (type == 'on_bicycle') {
BackgroundGeolocation.setConfig(Config(
distanceFilter: 25,
locationUpdateInterval: 4000,
fastestLocationUpdateInterval: 2000
));
} else if (type == 'in_vehicle') {
BackgroundGeolocation.setConfig(Config(
distanceFilter: 50,
locationUpdateInterval: 10000,
fastestLocationUpdateInterval: 5000
));
}
});
The values could come from some settings (default or configurable).
It's just a thought since you were soliciting feedback.
Excellent, thanks for your feedback.
Thank you Anton, that's very helpful, it makes perfect sense to use the IMU and manage two states: Moving and Stationary and only determine location and / or send updates when moving.
Even though I had set the accuracy to high, I had the impression that the updates were infrequent / course using Location=20m and Frequency=300s, but maybe I confused myself ; ) I will test again; I might take a few different Android devices with different settings with me on the same itinerary for some more controlled experiments and see how they compare.