I have done the following, I want to send location data to my backend when the app is closed, and while event listeners get called when the app is open or minimised, they don't get called when the app is closed.
The docs say "Add event listeners outside of your view lifecycle if you want them to work when the app is in the background.", and I have tried putting this code in different places, calling from the app's main method, the initState of the home page or from a riverpod provider, but none of them work when the app is closed.
@pragma('vm:entry-point')
static void onLocation(Map result) {
print('onLocation');
sendLocationToBackend(result);
}
Radar.attachListeners();
Radar.onLocation(onLocation);
I have done the following, I want to send location data to my backend when the app is closed, and while event listeners get called when the app is open or minimised, they don't get called when the app is closed.
The docs say "Add event listeners outside of your view lifecycle if you want them to work when the app is in the background.", and I have tried putting this code in different places, calling from the app's main method, the initState of the home page or from a riverpod provider, but none of them work when the app is closed.