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

watchPosition when app is closed. #403

Open
theobouwman opened this issue Mar 6, 2023 · 4 comments
Open

watchPosition when app is closed. #403

theobouwman opened this issue Mar 6, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@theobouwman
Copy link

Can I use this when I force close the app? Or have not even opened the app at all?

I want to track user location and maken api calls in the background.

@theobouwman theobouwman added the bug Something isn't working label Mar 6, 2023
@aqil07
Copy link

aqil07 commented May 21, 2023

Hi @theobouwman ,to achieve what you're asking, you would need to listen for AppStateChange and then do what you require, when the AppState is in the background. Refer to this: https://reactnative.dev/docs/appstate

@muhammadwaqas605
Copy link

facing same issue

@elibroftw
Copy link

elibroftw commented Aug 25, 2023

@aqil07 how would you use this? do we call watchPosition twice then? Once in foreground once in background?
(on a sidenote, my research has pointed me in the direction of "foreground via persistent notification" which is the correct solution. From a user POV apps should be informing users that they are running still, I just didn't know that the app itself has to spawn that notification)

@aqil07
Copy link

aqil07 commented Aug 27, 2023

Hi @elibroftw , correct. When the "AppState" changes, then we call watchPosition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants