Q: How to setup Terra iOS Background delivery

AfraidWeasel3 months ago

Hi there, we are trying to use Terras background delivery with the iOS SDK to get user activities whilst the app is in the background. However in testing it seems that no events are being sent to our webhook. What is the setup needed to enable this

terra

Chandruadmin3 months ago

Hey there

To ensure that your app supports background delivery, the following must be completed:

  1. Add the Background Modes capability and enable Background Processing and Background fetch. This can be done by opening your .xcodeproj file in XCode, navigating to Signing & Capabilities and pressing + Capability
  2. Add the HealthKit capability and enable Background delivery
  3. Add the terra Background task identifier: navigate to your .xcodeproj > Info and create/edit the list Permitted background task scheduler identifiers and add the element co.tryterra.data.post.request
  4. In the same tab, the key Privacy - Health Share Usage Description should be created with the value being a description of your use case (which must be > 2 words)
  5. Add the following to your AppDelegate file:
import UIKit import TerraiOS @main class AppDelegate: UIResponder, UIApplicationDelegate { func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { Terra.setUpBackgroundDelivery() return true } }

AfraidWeasel3 months ago

It seems to be working now, thank you for the help