yarn add react-native-background-geolocation
- For
background-geolocation >= 4.0.0
:
yarn add react-native-background-fetch@^4.0.1
- For
background-geolocation >= 3.6.0 < 4.0.0
:
yarn add [email protected]
- For
background-geolocation <= 3.5.0
yarn add [email protected]
npm install react-native-background-geolocation --save
- For
background-geolocation >= 4.0.0
:
npm install react-native-background-fetch@^4.0.1
- For
background-geolocation >= 3.6.0 < 4.0.0
:
npm install [email protected] --save
- For
background-geolocation <= 3.5.0
:
npm install [email protected] --save
$ cd ios
$ pod install
Open your App in XCode and select the root of your project. Select Capabilities tab. Enable Background Modes and enable the following modes:
- Location updates
- Background fetch
- Audio (optional for debug-mode sound FX)
Edit Info.plist
. Add the following items (Set Value as desired):
Key | Type | Value |
---|---|---|
Privacy - Location Always and When in Use Usage Description | String |
CHANGEME: Location required in background |
Privacy - Location When in Use Usage Description | String |
CHANGEME: Location required when app is in use |
Privacy - Motion Usage Description | String |
CHANGEME: Motion permission helps detect when device in in-motion |
The BackgroundGeolocation SDK makes use internally on react-native-background-fetch
. Regardless of whether you instend to implement the BackgroundFetch Javascript API in your app, you must perform the Background Fetch iOS Setup at react-native-background-fetch
.