> 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/important-topics/sdk/appendix/android/sample-notification.md).

# Sample Notification

The example below shows how to create a notification that can be passed to `SentianceOptions`. We use the `androidx.core.app.NotificationCompat` class to build a notification suitable for both old and recent Android versions.

The notification channel, necessary for Android 8 and above, has the channel importance set to `IMPORTANCE_LOW`, the minimum [recommended](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_MIN) by Google for notifications used for running services.

```java
private fun createNotification(): Notification {
    // PendingIntent that will start your application's MainActivity
    val intent = Intent(context, MainActivity::class.java)
    val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)

    // On Oreo and above, you must create a notification channel
    val channelId = "background_detections"
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        val channel = NotificationChannel(channelId, "Background Detections", NotificationManager.IMPORTANCE_LOW)
        channel.setShowBadge(false)
        val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
        notificationManager.createNotificationChannel(channel)
    }
    return Builder(context, channelId)
        .setContentTitle(context.getString(R.string.app_name).toString() + " is running")
        .setContentText("Touch to open.")
        .setContentIntent(pendingIntent)
        .setShowWhen(false)
        .setSmallIcon(R.mipmap.ic_launcher)
        .setPriority(NotificationCompat.PRIORITY_MIN)
        .build()
}
```

{% hint style="info" %}
You can quickly test the notification appearance by running a fresh app/SDK installation on an Android 8+ device. The notification will appear the first time the SDK starts automatic detections, or when you manually start a trip (more about this [here](https://github.com/sentiance/v4-docs/blob/main/important-topics/sdk/appendix/android/broken-reference/README.md)).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sentiance.com/important-topics/sdk/appendix/android/sample-notification.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
