Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listeners not being called in background (when app is closed) #60

Open
Jonny1987 opened this issue Jul 28, 2024 · 0 comments
Open

Listeners not being called in background (when app is closed) #60

Jonny1987 opened this issue Jul 28, 2024 · 0 comments

Comments

@Jonny1987
Copy link
Contributor

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant