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

Send http request on getLocationUpdates method #112

Closed
DevTiago opened this issue Aug 19, 2021 · 2 comments
Closed

Send http request on getLocationUpdates method #112

DevTiago opened this issue Aug 19, 2021 · 2 comments

Comments

@DevTiago
Copy link

Hey there,

Any chance i can send an http request to a server instead of printing the location on getLocationUpdates method?

BackgroundLocation.getLocationUpdates((location) {
  print(location);
});
@DevTiago
Copy link
Author

Well,

I figure that the problem is not the request to server but the background service that not work.

I've managed the AppLifecycleState on my App and when i pause it i set this code:

void didChangeAppLifecycleState(AppLifecycleState state) async  {
    switch (state) {
      case AppLifecycleState.paused:
        await BackgroundLocation.startLocationService();
        await BackgroundLocation.setAndroidConfiguration(5000);
        BackgroundLocation.getLocationUpdates((location) {
          print(DateTime.now());
        });
        break;

And when i pause the app i get the data/time but it stops after 30 seconds (more or less).

@DevTiago
Copy link
Author

I solved my problem with this answer.

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