Dolphin MOVE SDK
2.x
2.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
        • Access Control
        • Configuration
        • Timeline
        • Points of Interest
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
        • Troubleshooting
      • React Native
      • Flutter
      • Move SDK CLI
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Setup
        • Services
      • React Native
        • Components
        • Initialization
        • Services
      • Flutter
        • Initialization
        • Services
    • Models
      • Listeners/Callbacks
      • MoveAssistanceCallStatus
      • MoveAuth
      • MoveAuthError
      • MoveAuthResult
      • MoveAuthState
      • MoveConfig
      • MoveConfigurationError
      • MoveDevice
      • MoveDeviceStatus
      • MoveGeocodeError
      • MoveHealthItem
      • MoveHealthScore
      • MoveOptions
        • DeviceDiscovery
      • MoveSdkState
      • MoveSdkAndroidConfig
      • MoveTripState
      • MoveScanResult
      • MoveServiceFailure
      • MoveServiceWarning
      • MoveShutdownResult
    • Appendix
      • Token refresh
      • Android
        • Permission Handling
          • Permission Overview
          • Runtime Permissions
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
      • React Native
        • Permission Handling
  • MOVE Backend
    • MOVE Backend
      • MOVE Admin API
      • MOVE TIMELINE API
      • MOVE State API
      • MOVE Last Location API
    • MOVE Generic Notifier
    • MOVE Assistance Notifier
    • Example requests
  • FAQ
  • Changelog
    • Android
    • iOS
    • React
    • Flutter
    • Backend
  • Data privacy (GDPR)
Powered by GitBook
On this page
  • Required Permissions
  • Location Permission
  • Authorization
  • Plist
  • Background Mode
  • Sample Code
  • Motion Permission
  • .plist
  • Permission
  • Bluetooth Permission
  • Plist
  1. MOVE SDK
  2. Appendix
  3. iOS

Permissions Handling

Description of required permissions, how to request and manage them.

PreviousiOSNextApp Store

Last updated 1 year ago

Required Permissions

On SDK initialization, the host app passes a object to configure which of the SDK services should be activated. Some of those services require system permissions to be granted, or other features to be available.

From a usability perspective, Apple provides some guidelines about as part of their Human Interface Guidelines.

The table below shows each of the options and the corresponding required and optional permissions or sensors.

Service

Required permissions

Optional permissions[*]

Driving

Driving

Location Permission Precise Location

Motion Permission Background Location Permission

Distraction-Free-Driving

Gyroscope and Accelerometer availability

Driving Behavior events

Gyroscope and Accelerometer availability

Device Detection

Bluetooth Permission

Cycling

Bicycle

Location Permission

Motion Permission Precise Location

Background Location Permission

Walking

Walking

Motion Permission

Background Location Permission

Location

LocationPermission Precise Location

Background Location Permission

Places

Places

LocationPermission Precise Location

Points of Interest

Points of Interest

Location Permission Precise Location

Background Location Permission

Public Transport

Public Transport stops

Location Permission Precise Location

Background Location Permission

Impact Detection

Impact Detection

Location Permission Precise Location

Gyroscope and Accelerometer availability

Motion Permission

Background Location Permission

Assistance Call

Assistance Call

Location Permission Precise Location (required permission deprecated with v2.4.0+)

Location Permission Precise Location

[*] Optional permissions can be set to required on setup by passing a object with the flags motionPermissionMandatory and backgroundLocationPermissionMandatory to true.

Location Permission

Authorization

This section considers the iOS 13 system location permissions changes.

can be granted with one of the multiple access levels. Focusing only on the MOVE SDK relevant ones:

Automatic Detection

The MOVE SDK can automatically wake up the app and activate its services (like trip detection, etc..) fully in the background and without any user interaction. Even if the app was killed by the user.

Starting iOS 13, Apple introduced 2 levels of accuracy access:

The MOVE SDK requires full accuracy access to precisely detect trips and deliver high-quality service.

Plist

Apple requires apps requesting any system permission to provide reasoning for granting the permission. This reasoning is known as "purpose string" and is defined in the app's Info.plist file. Those purpose strings are displayed as an explanation of why the app needs those access types, in the alert shown by the system to ask the user for permission.

In the case of location permission, each access level requires including one or more corresponding keys with purpose strings.

Key

Required if

Your app requests "When In Use" authorization or "Always" authorization.

Your app requests "Always" authorization.

Your app supports iOS 10 and earlier and requests "Always" authorization.

Background Mode

Moreover, for background location access, Location update Background Modes must be enabled:

  1. Go to the Capabilities tab of your target settings

  2. Turn on Background Modes and enable Location updates

Sample Code

import CoreLocation
 
class Permission: NSObject {
    let locationManager = CLLocationManager()
 
    func requestLocationPermission() {
        locationManager.delegate = self
        locationManager.requestAlwaysAuthorization()
    }  
}
 
extension Permission: CLLocationManagerDelegate {
    public func locationManager(_: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
        // status
    }
}

Motion Permission

.plist

// Example .plist for permissions.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSBluetoothPeripheralUsageDescription</key>
	<string></string>
	<key>NSBluetoothAlwaysUsageDescription</key>
	<string></string>
	<key>CMMotionActivity</key>
	<string>We need your motion..</string>
	<key>CLAccuracyAuthorization</key>
	<string>We need your location...</string>
	<key>NSMotionUsageDescription</key>
	<string>We need your motion...</string>
	<key>NSLocationAlwaysUsageDescription</key>
	<string>We need your location..</string>
	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string>We need your location..</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>We need your location..</string>
	
...

Permission

There is no direct way to request Motion Activities access permission like with Locations. Instead, the permission prompts the first time the Motions API is called.

Requesting the motion permission will look something like this:

import CoreMotion
 
func requestCoreMotionPermission() {
    let manager = CMMotionActivityManager()
    let now = Date()
    
    switch CMMotionActivityManager.authorizationStatus() {
    case .restricted, .denied:
	// "NotAuthorized
    case .authorized:
	// "Authorized"
    case .notDetermined:
        manager.queryActivityStarting(from: now, to: now, to: .main) { activities, error in
        if let error = error as? NSError, error.code == Int(CMErrorMotionActivityNotAuthorized.rawValue) {
	    // "NotAuthorized"
	    } else {
	    // "Authorized"
	    }
        }
    }   
}

Bluetooth Permission

When using the Device Detection feature it's possible to get warnings for the Bluetooth permission and power status from the SDK.

Requesting the Bluetooth permission is done by creating an instance of the CBCentralManager type. This is entirely optional, and it's still possible to use the Device Detection service without this.

Due to Apple's static code analysis, additional strings must be configured in the Info.plist to pass validation when uploading to the AppStoreandTestflight even when this feature is not used.

Plist

Key

Required if

Submitting an App to Testflight or AppStore.

Required only your application is built for iOS 13.0 or below.

Starting iOS 13, system location is split into 2 layers: and

:

: The user authorized the app to start and access location services at any time. Can be requested by calling .

: The user authorized the app to start location services only while the app is in use. Can be requested by calling .

Starting with iOS 13, when an app requeststhe system prevents apps from directly receiving theaccess level. Instead, the operating system breaks the access into 2 steps.

First, the operating system shows the user the permission prompt for

Later on, the operating system shows the permission prompt when the app (in our case the MOVE SDK embedded in your app) fetches the location in the background for the first time.

Check this WWDC19 and for further information about the iOS 13 authorization status changes.

None of the SDK automatic detection services will work except if background location permissionis granted. Otherwise, the services will only work when the host app is in the foreground.

:

: The user authorized the app to access location data with full accuracy.

: The user authorized the app to access location data with reduced accuracy.

For more details about how to request location permissions, check out this Apple .

Requestinglocation authorization looks something like this:

Same as with Location permission, Motion permission requires including the with its corresponding purpose string in the app's Info.plist file.

These checks will only be performed when the App itself has requested Bluetooth permission from the user, specifically if is anything other than .notDetermined.

CLAuthorizationStatus
CLAccuracyAuthorization
CLAuthorizationStatus
CLAuthorizationStatus.authorizedAlways
requestWhenInUseAuthorization()
CLAuthorizationStatus.authorizedWhenInUse
requestAlwaysAuthorization()
.authorizedAlways
.authorizedAlways
.authorizedWhenInUse
.authorizedAlways
session
apple documentation
authorizationAlways
CLAccuracyAuthorization
.fullAccuracy
.reducedAccuracy
document
.authorizedAlways
NSMotionUsageDescription
CBCentralManager.authorization
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
NSBluetoothAlwaysUsageDescription
NSBluetoothPeripheralUsageDescription
MoveConfig
Requesting Permissions
MoveConfig
MoveOptions
Location updates background mode capability