Skip to main content

Android permissions

Permissions

This page contains details on permissions that need to be enabled on Android devices for the smooth performance of various Fairmatic SDK functionalities.

LegendMeaning
The permission is vital for this product to function.
Lack of this permission may interfere with the product's functioning.
The permission is not needed for the product to function.
ProductLocationActivityOverlay
Trip Detection
Trip Mileage
Collision Detection
Driving Behavior - Hard Brake
Driving Behavior - Hard Turns
Driving Behavior - Rapid Acceleration
Driving Behavior - Overspeeding
Driving Behavior - Phone Use
warning

Many SDK features are dependent on trip detection, therefore Location Permission is needed for every feature.

SDK Errors

The Fairmatic SDK provides the following permission errors to indicate high-priority permission needs:

ErrorDescription
LOCATION_PERMISSION_DENIEDThis error is sent if background location permission is denied, even if foreground permission is granted.
ACTIVITY_RECOGNITION_PERMISSION_DENIEDActivity permission is required for trip detection.
PRECISE_LOCATION_DENIEDThis will be returned on devices running on Android 12 and above when the user has set the location accuracy for the application as "Approximate". Fairmatic SDK needs the location access accuracy for the application to be set as "Precise" to operate.
LOCATION_MODE_HIGH_ACCURACY_DENIEDThis will be returned on devices running on Android versions 4.4 to 8.1 when user has not set location mode as LOCATION_MODE_HIGH_ACCURACY.
BACKGROUND_RESTRICTION_ENABLEDThis error indicates that background restrictions are on. Background restrictions may cause the trip to be missed while the app is in the background. If the app is running in the foreground, the trip may be detected.
GOOGLE_PLAY_CONNECTION_ERRORThis error indicates that something went wrong in trying to connect to Google Play Services. See Google Play Services reference.
AIRPLANE_MODE_ENABLEDThis error indicates that airplane mode is active. Airplane mode affects location accuracy and can affect all features.

The Fairmatic SDK provides the following permission errors to indicate low-priority permission needs:

ErrorDescription
BATTERY_OPTIMIZATION_ENABLEDThis 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.
INTERNAL_ERRORSome specific error occurred internally. It could be around battery or something OEM specific. Check if you are restricting the SDK ability due to some device setting

Handling Errors

We recommend acquiring permissions during an onboarding process that clearly explains why those permissions are needed. The onboarding process for location permission in our in-house app is shown below for reference.

Example permission flow for Android

Example permission flow for Android

If an error is thrown after the onboarding process, a notification can indicate to the user that certain permission is needed. Use that notification to direct them to the correct screen or one describing why the permission is needed.

Missing permission notification

Missing permission notification