Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 2.12 KB

INSTALL-IOS-AUTO.md

File metadata and controls

60 lines (38 loc) · 2.12 KB

iOS Auto-linking Installation

react-native >= 0.60

With yarn

yarn add https://github.com/transistorsoft/react-native-background-geolocation-android.git

yarn add react-native-background-fetch

With npm

npm install https://github.com/transistorsoft/react-native-background-geolocation-android.git --save

npm install react-native-background-fetch --save

pod install

$ cd ios
$ pod install

Configure Background Capabilities

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)

Configure Usage Strings in Info.plist

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

BackgroundFetch AppDelegate extension

BackgroundFetch implements an AppDelegate method didPerformFetchWithCompletionHandler. You must manually add this file to the same folder where your AppDelegate.m lives:

  • In the XCode's Project navigator, right click on project's name ➜ Add Files to <...>.
  • node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m.

node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m