Signals - iOS

OpenBack SDK v4 is broken into 4 frameworks:

  • Required: OpenBack.framework
  • Optional: OpenBackLocation.framework
  • Optional: OpenBackCoreMotion.framework
  • Optional: OpenBackBluetooth.framework

Separating Core Location, Core Motion and Core Bluetooth allows the app to ship without having to provide a privacy description for unused features.

note

None of the OpenBack frameworks will request user authorizations. You are responsible for asking the user.

Signals

The following signals require integrating one of the optional framework, adding privacy usage descriptions and requesting user authorizations.

Activity Signal

The preferred way is to use the OpenBackCoreMotion framework with the Activity Manager but it is possible to use the OpenBackLocation framework too.

Location Signal

Use the OpenBackLocation framework.

If messages using user location will be used, the Always location authorization needs to be enabled. It allows OpenBack to handle significant location changes that can be used to wake up the application in the background even after it was swipe closed (force kill). If a user swipe closes the application and doesn't go anywhere far enough to signal a significant location change, the application will not re-start and OpenBack will not be able to check the messages. Traditional push notifications aren't ever received after a force kill.

note

When using significant location change, iOS will likely display an alert after a few days to inform users that your application has been using location in the background.

Bluetooth Connectivity Signal

Use the OpenBackBluetooth framework.

Noise Signal

See Adding Microphone Support.

It works by analyzing recording samples on the fly but none of the data is stored anywhere (going to /dev/null). Asking for the microphone authorization may cause users to question the need for it, so OpenBack only recommends using this trigger for specific and useful scenarios for the user. Typically, unless the application already uses the micophone, we don't recommend you use noise trigger on iOS.

Other Apps Signal

If using the Other Apps signal or plan to deep link into other apps, the list of Other Apps must be set in the project PList beforehand. Applications have to declare the list of URL Schemes they wish to check using canOpenURL:. Use the LSApplicationQueriesSchemes key of an array of strings.

The list of other apps to check is defined during setup using either the Dashboard or email them to onboarding@openback.com

URL Schemes

Alert Notifications Authorization

It is likely that the majority of messages are triggered while your application is in the backbround. It is therefore very important to get the user's authorization to display Alert Notifications. We also suggest asking the user at the right time. Prompting the user right when the application is starting for the first time will likely result in denied request.

Example request:

UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
[notificationCenter requestAuthorizationWithOptions:UNAuthorizationOptionAlert + UNAuthorizationOptionBadge + UNAuthorizationOptionSound completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted) {
// Yeah!
}
}];

Adding Core Location Support

Add the OpenBackLocation framework

pod 'OpenBackLocation

Add privacy descriptions

In your Info.plist, add a description for the 3 keys:

  • NSLocationAlwaysUsageDescription
  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysAndWhenInUseUsageDescription

Requesting location authorization

// Create a location manager
self.locationManager = [CLLocationManager new];
[locationManager setDelegate:self]
// Check the authorization status
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (status == kCLAuthorizationStatusNotDetermined) {
// Requesting always for example
[locationManager requestAlwaysAuthorization];
}

Using the Always authorization provides some extra benefits for the OpenBack SDK: access to significant location change that can re-launch a force killed app, precise location in the background. But you have to provide good reasons to the App Store reviewers for using this feature.

Adding Core Motion Support

Core Motion is used for collecting sensors (accelerometer, gyroscope, motion) and user activity. Getting the user activity requires asking the user for authorization.

Add the OpenBackCoreMotion framework

pod 'OpenBackCoreMotion'

Add privacy descriptions

In your Info.plist, add the following usage description key:

  • NSMotionUsageDescription

Requesting activity authorization

// Check the authorization status
if ([CMMotionActivityManager authorizationStatus] == CMAuthorizationStatusNotDetermined) {
// Simply creating a manager will prompt the user
[CMMotionActivityManager new];
}

Adding Core Bluetooth Support

Core Bluetooth is used for checking the bluetooth radio status (on/off).

Add the OpenBackBluetooth framework

pod 'OpenBackBluetooth'

Add privacy descriptions

In your Info.plist, add the following usage description key:

  • NSBluetoothAlwaysUsageDescription
  • NSBluetoothPeripheralUsageDescription: Required if targeting iOS12 and below, deprecated from iOS13 but can be left in regardless

Adding Microphone Support

Microphone needs the AVFoundation framework which is already a dependency of the core OpenBack framework.

Add privacy descriptions

In your Info.plist, add the following usage description key:

  • NSMicrophoneUsageDescription

In-App Video and Image Messages

For using videos or images in notifications, it is highly recommended to use a URL using HTTPS. If you need to allow HTTP links from certain domains, add the following to your Info.plist.

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>