Closed dJani97 closed 1 year ago
Android or iOS?
Forgot to include details!
Yes, I'm running on Android with the following dependency versions:
Flutter 3.7
Dart 2.19.0
background_location_tracker: ^1.4.0
Yeah this is something we see on android devices not directly from Google. We request the correct flags to keep things running in background, but the OEMs decide they won't follow the rules. (looking at you oneplus for not allowing the clock app to run in the background and thus causing me to miss alarms).
Can you try to exclude the app from battery optimisations? That seems to work for us
Hi!
I've been chasing this problem for a while so I thought I'll post it here.
I'm working on a location-tracker app that will record the user's position in the background, and do a couple of things:
I'm running into a weird problem while developing this app. The callback function starts running, executes a couple of instructions, and then randomly halts without any error message.
The weird thing is, I've tried running the debugger to see if there are any uncaught exceptions, and with the debugger attached, the entire callback function is executed just fine! No errors. It does what it should.
But once I detach the debugger and just simply use
flutter run
, execution stops about halfway through the callback.I'm not doing anything resource-intensive, there are a couple of read/write operations and a call to a REST API, but the entire thing shouldn't take more than 50-100ms, and most of this is asynchronous waiting.
Since it is not consistent, my only thought is that there may be a time limit, maybe only a couple of milliseconds allowed for the callback. Is this scenario possible? If it is, how could I execute more complex operations, like caching and/or sending the locations over HTTP?
An oversimplified version of my code looks kinda like this:
Maybe it is happening because of all the async operations? Maybe I'm not properly awaiting execution somewhere?