Permission Handling
Description of required permissions, how to request and manage them.
Last updated
Description of required permissions, how to request and manage them.
Last updated
The library requires at least the following permissions to access Move services.
Depending on the used services, different permissions are required. The following table gives an overview what's required:
Background Location is not mandatory, but strongly recommended. Similarly for the optional Activity Recognition permission (Driving) - make sure to request this from the user, otherwise it will degrade the quality of the service.
More Information regarding the system permissions can be found here: https://developer.android.com/reference/android/Manifest.permission
The required permissions must be granted before the services can be used. If any single required permission is missing, the entire SDK stops working. In case of any permission error, the SDKState callback will be triggered with an error state: MoveSdkState.Error
If there are permissions missing, the state is an object of type MoveSdkState.Error. The error state contains an error reason which can be any of the following:
Overlay (ErrorReason.PermissionMissing.Overlay)
Location (ErrorReason.PermissionMissing.Location)
Phone (ErrorReason.PermissionMissing.Phone)
Activity (ErrorReason.PermissionMissing.Motion) (since Android 10 )
The PermissionMissing error reason contains a string pertaining to the relevant permission of the Android Manifest, e.g. Manifest.permission.READ_PHONE_STATE. This permission string can be used to request dangerous permission directly as shown in the code example below. For more information about dangerous visit the official developer page.
In fact the SDK is not aware of permission changes, the developer can tell the SDK that the error is resolved. This can be done for example in onRequestPermissionsResult().
In Android there are some permissions which require a request during runtime. Keep in mind that those need to be defined in the manifest as well. Before init of the MOVE SDK, the proper permissions should have been already requested.
The overlay permission (SYSTEM_ALERT_WINDOW) ,which is required for distraction free driving, needs to be requested in a specific way. The user is lead to the app settings where the permission needs to be enabled.
Starting with Android 11, the user will only be taken to the settings overview screen, and the user needs to select the specific app itself.
Since Android 10 there is an additional background location which should be also requested when asking for location permission. In Android 11 the user must go to the location settings of the app to grant the "Allow all the time" permission.
The following shows an example which is used in our demo app.
Required permissions
Optional permissions
Mode of Transport
Driving
ACTIVITY_RECOGNITION - improves trip recognition and classification considerably
Bicycle
Walking
Driving Services
Distraction-Free-Driving (DFD)
Driving behaviour events (DBE)
Other services
Points of Interest