Android Permissions
This page contains details on permissions that need to be enabled on Android devices for smooth performance of various Zendrive SDK functionalities. The following table provides a list of user permissions, which are marked as follows:
Vital: The permission is vital for the product to function.
Not Required: The permission is not required for the product to function.
Automatic Trip Detection (Trip Start)
Vital
Vital
Vital only if Bluetooth-based trip start is enabled.
Vital
Automatic Trip Detection (Trip End)
Vital
Vital
Not required
Not required
Trip Mileage
Vital
Vital
Not required
Not required
Collision Detection
Vital
Vital
Not required
Not required
Driving Behavior - Hard Brake
Vital
Vital
Not required
Not required
Driving Behavior - Hard Turns
Vital
Not required.
Not required.
Not required.
Driving Behavior - Rapid Acceleration
Vital
Not required.
Not required.
Not required.
Driving Behavior - Over-speeding
Vital
Not required.
Not required.
Not required.
Driving Behavior - Phone Use
Vital
Not required.
Not required.
Vital
Vehicle Tagging
Vital
Not required
Vital
Not required.
Many SDK features are dependent on trip detection; therefore Location Permission is vital for every feature.
The location permission must be granted for precise location. Once users give permission, the operating system provides precise location access. However, users can manually switch to 'approximate location.' In such cases, the SDK will not function, and an associated error is generated.
Bluetooth Permissions
Android 12 requires the addition of two new Bluetooth permissions in the Manifest file if the customer uses either bluetooth or beacon-related features, as follows:
Bluetooth_Scan
Bluetooth_Connect
Examples:
android.permission.BLUETOOTH_SCAN
android.permission.BLUETOOTH_CONNECT
SDK Errors
Zendrive SDK provides the following permission errors to indicate high priority permission needs:
LOCATION_PERMISSION_DENIED
This error is sent if background location permission is denied, even if foreground permission is granted.
ACTIVITY_RECOGNITION_PERMISSION_DENIED
Activity permission is required for trip start detection. If permission is revoked after a trip is started, it will continue to be recorded.
BACKGROUND_RESTRICTION_ENABLED
This error indicates that background restrictions are on. Background restrictions may cause the trip to be missed while the app is in background. If the app is running in the foreground, the trip may be detected.
GOOGLE_PLAY_CONNECTION_ERROR
This error indicates that something went wrong in trying to connect to Google Play Services. This occurs rarely.
Use hasResolution()
to see if the issue is resolvable by the user. See Google Play Services reference.
AIRPLANE_MODE_ENABLED
This error indicates that airplane mode is active. Airplane mode affects location accuracy and can affect all features.
Zendrive SDK provides the following permission errors to indicate low priority permission needs:
GOOGLE_PLAY_SETTINGS_ERROR
This is usually a sign of not accepting Google's terms for improving location accuracy. It's easy to request this with the LocationSettingsResult
object returned as part of this error.
WIFI_SCANNING_DISABLED
This error indicates that Wifi scanning is disabled in the settings.
POWER_SAVER_MODE_ENABLED
This is reported as an error for Android release 9 (API level 28 and above) and warning for the older versions. If the power saver mode is enabled, the SDK cannot detect trips and will report it as an error.
BATTERY_OPTIMIZATION_ENABLED
This is the standard battery optimization setting on Android. However, Samsung's implementation restricts background execution significantly on many devices. So, this error is thrown only on Samsung devices.
ONE_PLUS_DEEP_OPTIMIZATION
This error is only relevant for OnePlus devices.
OVERLAY_PERMISSION_DENIED
This error is thrown if the app cannot draw over other apps. This is only needed for phone use.
BLUETOOTH_DISABLED
This error is thrown if bluetooth permission is needed. Bluetooth is used for vehicle tagging and bluetooth trip start.
LOCATION_MODE_HIGH_ACCURACY_DENIED
This error will be returned on devices running on Android versions 4.4 to 8.1 when the user has not set location mode as High Accuracy.
BLE_PERMISSION_DENIED
If the user removes or denies the BLUETOOTH_SCAN
permission.
BLUETOOTH_PERMISSION_DENIED
If the user removes or denies the BLUETOOTH_CONNECT
permission.
Handling Errors
We recommend acquiring permissions during an onboarding process that clearly explains why those permissions are needed. If an error is thrown after the in-boarding process, a notification can indicate to the user that a specific permission is needed. Use that notification to direct them to the correct permission screen or a screen describing why the permission is needed.
Was this helpful?