# Foreground Service

When the Sentiance SDK runs in the background, it starts a foreground service to maintain reliable detections. This is a requirement enforced by Android to ensure long-running background processing can continue even when the app is not in focus.

## Foreground Service Notifications

Starting a foreground service requires showing a persistent notification. This is mandated by the Android OS to inform users about ongoing background work.

By default, the SDK displays a minimal notification using the app’s name and icon. However, you can fully customize this notification to match your app’s branding and use case.

To customize the notification, create a notification object and [set it on the SDK initialization options](https://docs.sentiance.com/important-topics/sdk/appendix/android/pages/-LVyhs06ChG1vuX68mpf#id-3.-customize-the-android-notification-optional). At runtime, you can update this notification by calling [updateSdkNotification](/important-topics/sdk/api-reference/android/sentiance.md#updatesdknotification).

## Foreground Service Types

In compliance with Android 14 (API level 34) and higher, foreground services must declare a specific service type in the manifest. The Sentiance SDK declares the following service types in its Android Manifest:

* **location**: indicates that the service is accessing location data in the background.
* **shortService**: indicates that the service is expected to run short tasks.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sentiance.com/important-topics/sdk/appendix/android/foreground-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
