> For the complete documentation index, see [llms.txt](https://docs.sentiance.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sentiance.com/getting-started/sdk-integration/1.-requirements/android.md).

# Android

## Platform

### Android 7.0 (API Level 24) or Higher

This is the minimum supported Android version. If you support an older Android version, you can still include the Sentiance SDK, however, detections will not run.&#x20;

If you face any build issues, check out [this](https://docs.sentiance.com/important-topics/sdk/troubleshooting/android#manifest-merger-failed-uses-sdk-minsdkversion-x-cannot-be-smaller-than-version-y-declared-in-library) troubleshooting guide.

### Google Play Services

The Sentiance SDK relies on several Google Play Services features, such as Fused Location and  Geofencing.

***

## Permissions

### Location <a href="#location" id="location"></a>

To collection location data in the background, the SDK requires the [background location access permission](https://developer.android.com/reference/android/Manifest.permission#ACCESS_BACKGROUND_LOCATION). This is shown as "**Allow all the time**" in the permission dialog.

The SDK automatically adds the `ACCESS_FINE_LOCATION` and `ACCESS_COARSE_LOCATION` permissions to your app's manifest, however **you must add** the `ACCESS_BACKGROUND_LOCATION` permission yourself.

{% code title="AndroidManifest.xml" %}

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

{% endcode %}

{% hint style="warning" %}
**This permission is mandatory**

Without this permission, SDK detections will not work. This permission enables the SDK to collect location data in the background, and make use of [Geofencing](https://developer.android.com/develop/sensors-and-location/location/geofencing).
{% endhint %}

### Activity Recognition <a href="#activity-recognition-android-10" id="activity-recognition-android-10"></a>

To get notified of activity updates (e.g. walking, running), the SDK requires the [activity recognition permission](https://developer.android.com/reference/android/Manifest.permission#ACTIVITY_RECOGNITION).

{% code title="AndroidManifest.xml" %}

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

{% endcode %}

{% hint style="info" %}
**This permission is optional**

When granted, this permission helps improve the quality of the detections. Therefore, it is **highly recommended** to ask the user to grant this permission.
{% endhint %}

### Foreground Service (auto-granted) <a href="#foreground-service-auto-granted" id="foreground-service-auto-granted"></a>

Apps targeting API level 28 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, and specifies the [service types](https://developer.android.com/about/versions/14/changes/fgs-types-required) **location** and **shortService**.

### Wake Locks (auto-granted) <a href="#foreground-service-auto-granted" id="foreground-service-auto-granted"></a>

To collect sensor data in the background (e.g. accelerometer and gyroscope data), the Sentiance SDK makes use of [Android WakeLocks](https://developer.android.com/develop/background-work/background-tasks/awake/wakelock) to temporarily prevent the device from sleeping.

WakeLocks are held only when necessary, for example, while the user is on the move.&#x20;

{% hint style="info" %}
For the complete list of Manifest permissions added by the SDK, see [this page](/sdk/appendix/android/manifest-permissions.md).
{% endhint %}

***

## Runtime

### Google Play Services - Geofence Usage Limits

The Sentiance SDK uses the Geofence feature provided by Google Play Services. There is currently a per-app limit of [100 geofences](https://developers.google.com/android/reference/com/google/android/gms/location/LocationStatusCodes#public-static-final-int-geofence_too_many_geofences), and a total of [5 PendingIntents](https://developers.google.com/android/reference/com/google/android/gms/location/LocationStatusCodes#public-static-final-int-geofence_too_many_pending_intents) that can be set at any point in time. This limit is enforced by Google Play Services.

For proper operation and detections, please ensure that the Sentiance SDK can set **2 geofences**, and can consume **1 PendingIntent**, at any given time.

***

Get started by [including the SDK](/getting-started/sdk-integration/2.-including-the-sdk/android.md).
