Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 2.13 KB

INSTALL-IOS-COCOAPOD.md

File metadata and controls

54 lines (35 loc) · 2.13 KB

iOS Cocoapods Installation

You will have to install the plugin by manually downloading a Release from this repository. The plugin is not currently submitted to a package manager (eg: jCenter)

Podfile

Add the following pod to your Podfile, providing the path to where you installed the background-geolocation-lt SDK:

pod 'BackgroundGeolocation', :path => '../Libraries/background-geolocation-lt/ios/BackgroundGeolocation.podspec'
$ pod install

Configure Background Capabilities

With YourApp.xcworkspace open in XCode, add the following Background Modes Capabilities:

  • Location updates
  • Background fetch
  • Audio (optional for debug-mode sound FX)

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

Background Fetch API

The Background Geolocation SDK is integrated with the iOS Background Fetch API.

In Your AppDelegate.h, add the following block:

@import TSBackgroundFetch;

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    TSBackgroundFetch *fetchManager = [TSBackgroundFetch sharedInstance];
    [fetchManager performFetchWithCompletionHandler:completionHandler applicationState:application.applicationState];
}