Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 292 forks source link

Get Location when App is in the background #243

Open Stophface opened 3 years ago

Stophface commented 3 years ago

Is there a code example of how to get the location data when the app runs in the background?

Agontuk commented 3 years ago

You can use react-native-background-fetch library to execute task in background.

rezasazesh commented 3 years ago

@Agontuk Thanks for this awesome library, doesn't watchPosition also run in the background?

Agontuk commented 3 years ago

Not by default, you have to use some kind of work scheduler to request location in background. react-native-background-fetch should do the trick as far as I know.

micro1226 commented 3 years ago

here is iOS solution:

  1. open iOS project
  2. open info.plist
  3. add Required background modes and expand it
  4. add App registers for location updates

Done~

Rc85 commented 2 years ago

here is iOS solution:

  1. open iOS project
  2. open info.plist
  3. add Required background modes and expand it
  4. add App registers for location updates

Done~

Does this eliminate the 15 minutes fetch limit?