I have a React Native Mobile App on Expo that uses location both in background and foreground. But I have a problem because when the app is closed (both on Android and iOS) it continues sending the user location to the server.
I need a way to detect when the App is closed (not backgrounded) to execute 2 actions:
- Stop Location Updates
- Mutate the userState to offline in the DB
In order to solve the problem I tried multiple solutions:
- React Native AppStates
- ComponentWillUnmount
- Unnoficial libraries like EventLifeCycle Listeners, etc.
Anyone can save me on this one? :)