Skip to main content

AndroidOptions

Android-specific notification settings.

Importance, sound, vibration, lights, and badge behavior belong to the notification's channel; see NotificationChannel.

Properties

  • additional_flags - Additional native Android notification flags, combined using |.
  • auto_cancel - Whether tapping the notification automatically dismisses it.
  • badge_number - Notification count displayed by launchers that support badge numbers.
  • category - Semantic category used by Android to rank and filter notifications.
  • channel - Channel the notification is posted to.
  • chronometer_count_down - Whether the chronometer counts down rather than up.
  • color - Android notification accent color.
  • colorized - Whether to use color for the notification background.
  • full_screen_intent - Whether to request full-screen presentation when the notification arrives.
  • group - Group this notification belongs to.
  • icon - Bundled drawable resource name for this notification's small icon.
  • large_icon - Large image shown beside the notification content, such as a contact photo.
  • led_off_duration - Time the notification LED remains off between blinks.
  • led_on_duration - Time the notification LED remains on during each blink.
  • ongoing - Whether to mark the notification as an ongoing activity.
  • only_alert_once - Whether sound, vibration, and ticker alert only on the first display.
  • priority - Notification priority.
  • progress - Progress bar shown in the notification.
  • shortcut_id - ID of a published, long-lived sharing shortcut linked to the notification.
  • show_timestamp - Whether to display the notification timestamp.
  • silent - Whether to suppress sound and vibration for this notification.
  • style - Expanded layout of the notification; see AndroidStyle.
  • sub_text - Supplementary information displayed in the notification template.
  • tag - Additional identifier for immediately displayed Android notifications.
  • ticker - Ticker text sent to Android accessibility services.
  • timeout_after - Time after posting before Android cancels the notification.
  • timestamp - Time displayed on the notification.
  • uses_chronometer - Whether to show elapsed time from timestamp instead of a timestamp.
  • visibility - How much content may appear on a secure lock screen.

Properties​

additional_flagsclass-attributeinstance-attribute​

additional_flags: AndroidFlag | int | None = None

Additional native Android notification flags, combined using |.

For example, combine AndroidFlag.INSISTENT and AndroidFlag.NO_CLEAR to request repeating audio and retention when the user presses Clear all.

Note

Android may restrict the effect of individual flags.

A raw integer bitmask is also accepted for Android flags not represented by AndroidFlag. Combine integer flag values using | in the same way. See Android's notification flags for their meanings and restrictions.

Flags are added after the notification is built. None or AndroidFlag.NONE adds no flags and does not clear flags set by other options. Prefer dedicated options such as ongoing and auto_cancel when available.

auto_cancelclass-attributeinstance-attribute​

auto_cancel: bool | None = None

Whether tapping the notification automatically dismisses it.

badge_numberclass-attributeinstance-attribute​

badge_number: int | None = None

Notification count displayed by launchers that support badge numbers.

Note

Ignored when the launcher does not support this feature.

categoryclass-attributeinstance-attribute​

category: AndroidCategory | None = None

Semantic category used by Android to rank and filter notifications.

See AndroidCategory for the supported categories. This does not change the notification channel's importance.

channelclass-attributeinstance-attribute​

channel: NotificationChannel | str | None = None

Channel the notification is posted to.

Pass a NotificationChannel to create the channel on first use, or the ID of a channel created earlier with Notifications.create_channel. A missing channel referenced only by ID is created with the name "Notifications" and default settings. None uses the extension's default channel.

Note

Before Android 8.0, which has no channels, the channel's sound, vibration, lights, and importance apply to the individual notification.

chronometer_count_downclass-attributeinstance-attribute​

chronometer_count_down: bool | None = None

Whether the chronometer counts down rather than up.

Note

Supported only on Android 7.0+. Requires uses_chronometer to be enabled.

colorclass-attributeinstance-attribute​

color: ColorValue | None = None

Android notification accent color.

Accepts Flet color names and hexadecimal colors. Theme-dependent colors, such as ft.Colors.PRIMARY, cannot be resolved by this headless service.

colorizedclass-attributeinstance-attribute​

colorized: bool | None = None

Whether to use color for the notification background.

Note

When disabled, the color accents the app icon. Android usually restricts background coloring to foreground-service notifications.

full_screen_intentclass-attributeinstance-attribute​

full_screen_intent: bool | None = None

Whether to request full-screen presentation when the notification arrives.

Note

Requires the "android.permission.USE_FULL_SCREEN_INTENT" permission in [tool.flet.android.permission] and, on Android 14+, full-screen-intent access. See Notifications.request_full_screen_intent_permission. Android may show a heads-up notification instead. A full-screen launch is reported through Notifications.on_tap.

On a locked device, Android turns the screen on and starts the app, but the app stays behind the lock screen: the user sees the notification there and reaches the app after unlocking.

groupclass-attributeinstance-attribute​

group: AndroidGroup | None = None

Group this notification belongs to.

None leaves the notification ungrouped.

iconclass-attributeinstance-attribute​

icon: str | None = None

Bundled drawable resource name for this notification's small icon.

Supply the resource name without a file extension, such as "ic_stat_notify". None uses Notifications.android_default_icon.

Note

Use a white silhouette on a transparent background, with resources sized for the supported screen densities. Android Studio's notification icon wizard generates the appropriate drawable variants. Android uses the icon's alpha channel to determine its visible shape; an opaque background can appear as a solid block.

Add the drawable with the res_dir build setting, for example as drawable/ic_stat_notify.png. Bundled resources exist only in apps built with flet build or flet debug; under flet run, a missing icon raises NotificationException.

large_iconclass-attributeinstance-attribute​

large_icon: AndroidBitmap | None = None

Large image shown beside the notification content, such as a contact photo.

None shows no large icon.

led_off_durationclass-attributeinstance-attribute​

led_off_duration: DurationValue | None = None

Time the notification LED remains off between blinks.

Note

Effective only before Android 8.0, where the LED blinks in the channel's led_color only when both led_on_duration and led_off_duration are set. On newer versions, the device controls the blinking pattern.

led_on_durationclass-attributeinstance-attribute​

led_on_duration: DurationValue | None = None

Time the notification LED remains on during each blink.

Note

Effective only before Android 8.0, where the LED blinks in the channel's led_color only when both led_on_duration and led_off_duration are set. On newer versions, the device controls the blinking pattern.

ongoingclass-attributeinstance-attribute​

ongoing: bool | None = None

Whether to mark the notification as an ongoing activity.

Note

Android controls whether the user can dismiss ongoing notifications; this does not start a foreground service.

only_alert_onceclass-attributeinstance-attribute​

only_alert_once: bool | None = None

Whether sound, vibration, and ticker alert only on the first display.

Enable when repeatedly updating the same notification, such as a progress notification, without alerting on each update.

priorityclass-attributeinstance-attribute​

priority: AndroidPriority | None = None

Notification priority.

Note

Used on Android 7.1 and earlier. On Android 8.0+, the channel's importance applies instead.

progressclass-attributeinstance-attribute​

progress: AndroidProgress | None = None

Progress bar shown in the notification.

None shows no progress bar.

shortcut_idclass-attributeinstance-attribute​

shortcut_id: str | None = None

ID of a published, long-lived sharing shortcut linked to the notification.

Note

On Android 11+, this can help a messaging notification appear in the conversation section. This extension does not create the shortcut.

show_timestampclass-attributeinstance-attribute​

show_timestamp: bool | None = None

Whether to display the notification timestamp.

Set timestamp to override the displayed time.

silentclass-attributeinstance-attribute​

silent: bool | None = None

Whether to suppress sound and vibration for this notification.

This is a per-notification setting, distinct from changing the channel's sound and vibration configuration.

styleclass-attributeinstance-attribute​

style: AndroidStyle | None = None

Expanded layout of the notification; see AndroidStyle.

None uses the standard layout.

sub_textclass-attributeinstance-attribute​

sub_text: str | None = None

Supplementary information displayed in the notification template.

Note

Android 7.0+ places this in the header. Earlier versions use the same line as the progress bar, so avoid using both on those versions.

tagclass-attributeinstance-attribute​

tag: str | None = None

Additional identifier for immediately displayed Android notifications.

The same (tag, id) pair replaces a visible notification. Pass the tag to Notifications.cancel to remove it. Scheduled alarms use only the notification ID, not this pair.

tickerclass-attributeinstance-attribute​

ticker: str | None = None

Ticker text sent to Android accessibility services.

timeout_afterclass-attributeinstance-attribute​

timeout_after: DurationValue | None = None

Time after posting before Android cancels the notification.

None does not request automatic cancellation after a timeout.

timestampclass-attributeinstance-attribute​

timestamp: datetime | None = None

Time displayed on the notification.

When None, uses the notification's posting time. This does not schedule delivery; use Notifications.schedule for that.

Timezone-aware values preserve their instant. A naive datetime is interpreted in the Python host's local timezone.

uses_chronometerclass-attributeinstance-attribute​

uses_chronometer: bool | None = None

Whether to show elapsed time from timestamp instead of a timestamp.

Android updates the minutes and seconds automatically, which is useful for ongoing calls or timers.

visibilityclass-attributeinstance-attribute​

visibility: AndroidVisibility | None = None

How much content may appear on a secure lock screen.

None leaves the choice to Android. See AndroidVisibility.