6. Permissions

To ensure accurate detections, the Sentiance SDK requires specific permissions to be granted by the user during the application's runtime. It's crucial to obtain these permissions as part of your application's onboarding flow, explaining to the user why each permission is necessary. Below are the permissions required for proper functioning of the Sentiance SDK on Android:

Location

When running the SDK on Android 6 and above, it is necessary to request the user for the location permission.

For devices targeting API level 29 and above, you are also required to ask for the background location access permission (i.e., allow all the time).

On Android 10 and above, the background location access permission is crucial for the SDK to function correctly. This permission enables the use of Google Play Service Geofences, which the Sentiance SDK utilizes for detection stability and battery efficiency.

The SDK automatically adds the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions to your app's manifest, however it does not add the ACCESS_BACKGROUND_LOCATION permission.Therefore, it's essential to explicitly include it in your app's manifest as shown below:

AndroidManifest.xml
<manifest...>
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION">
    ...

Activity Recognition (Android 10+)

For devices targeting API level 29 and above, you must ask the user for the activity recognition permission. This permission grants access to the user's physical activity data, such as biking, walking, etc.

While this permission is not mandatory, granting it can improve the quality of detections. For example, the Sentiance SDK uses activity data to enhance the detection of trip starts.

The SDK does not automatically add the android.permission.ACTIVITY_RECOGNITION permission to your app's manifest. You must explicitly add it in the manifest as follows:

AndroidManifest.xml
<manifest...>
    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION">
    ...

Foreground Service (auto-granted)

Apps targeting Android 9 and above must have the FOREGROUND_SERVICE permission specified in the application manifest file.

The Sentiance SDK automatically adds this permission to your app's manifest. However, you should make sure to compile your app against API level 34, in order to support the foreground service types that are required by the Sentiance SDK. At the moment, these types are: health, location, and shortService.

For more details, please see the following troubleshooting guide.

Last updated