AgentRunNotifications

class AgentRunNotifications(context: Context, val channelId: String = CHANNEL, @DrawableRes smallIcon: Int = R.drawable.ai_elements_ic_agent)(source)

The agent's run as notifications. While it runs: one ongoing notification that follows it, as an Android 16 Live Update (ProgressStyle, promoted to the status bar chip and the lock screen, shortCriticalText in the chip) and a plain progress notification on earlier versions. When it ends: a "reply ready" (or "stopped") notification. Every text comes from AgentProgress.

Approvals are not answered from the notification: it says the agent is waiting and opens the chat, where the user sees what the call would do.

This artifact declares POST_NOTIFICATIONS (which the app asks for at runtime) and POST_PROMOTED_NOTIFICATIONS. An app that keeps the run going in the background posts running from a foreground service.

Constructors

Link copied to clipboard
constructor(context: Context, channelId: String = CHANNEL, @DrawableRes smallIcon: Int = R.drawable.ai_elements_ic_agent)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun cancel(id: Int)
Link copied to clipboard

Creates the channel (once); call before posting.

Link copied to clipboard
fun finished(progress: AgentProgress, title: String, contentIntent: PendingIntent?): Notification

The notification of a finished run: the reply's start, or why it stopped.

Link copied to clipboard
fun post(id: Int, notification: Notification): Boolean

Posts notification as id if the app may post notifications; returns whether it did.

Link copied to clipboard
fun running(progress: AgentProgress, title: String, contentIntent: PendingIntent?, stopIntent: PendingIntent? = null, startedAtMs: Long = System.currentTimeMillis()): Notification

The ongoing notification of a run in progress.