Skip to main content

DarwinOptions

Notification content and foreground presentation on iOS and macOS.

Presentation flags set to None inherit the plugin's initialization defaults, which this extension leaves enabled. They affect presentation when the app is in the foreground; they do not grant notification permission.

Properties

  • attachments - Local device file paths of media to attach to the notification.
  • badge_number - Number to apply to the application icon badge.
  • critical_sound_volume - Volume of a critical-alert sound, from 0.0 to 1.0.
  • interruption_level - Delivery urgency on iOS 15+ and macOS 12+.
  • present_alert - Whether to display a foreground alert using the older presentation option.
  • present_badge - Whether to apply the badge while the app is in the foreground.
  • present_banner - Whether to show a foreground banner.
  • present_list - Whether to add a foreground notification to Notification Center.
  • present_sound - Whether to play sound while the app is in the foreground.
  • sound - Name of a notification sound file in the app bundle.
  • subtitle - Secondary description displayed between the title and body.
  • thread_identifier - Identifier used to group related notifications in Notification Center.

Properties​

attachmentsclass-attributeinstance-attribute​

attachments: list[str] | None = None

Local device file paths of media to attach to the notification.

Note

Supported only on iOS 10+ and macOS 10.14+. Files must be accessible to the app and use a media format accepted by Apple's notification framework. These are device paths, not URLs or paths on the Python server.

badge_numberclass-attributeinstance-attribute​

badge_number: int | None = None

Number to apply to the application icon badge.

Use 0 to clear the badge, a positive number to set it, or None to leave it unchanged.

Note

Requires badge authorization.

critical_sound_volumeclass-attributeinstance-attribute​

critical_sound_volume: float | None = None

Volume of a critical-alert sound, from 0.0 to 1.0.

Note

Used only for critical alerts on iOS 12+ and macOS 10.14+. Requires the critical-alert entitlement and authorization; see DarwinInterruptionLevel.CRITICAL.

interruption_levelclass-attributeinstance-attribute​

interruption_level: DarwinInterruptionLevel | None = None

Delivery urgency on iOS 15+ and macOS 12+.

Note

See DarwinInterruptionLevel for presentation behavior and capability requirements. None leaves the level to the system.

present_alertclass-attributeinstance-attribute​

present_alert: bool | None = None

Whether to display a foreground alert using the older presentation option.

On newer systems, use present_banner and present_list. None inherits the enabled initialization default.

present_badgeclass-attributeinstance-attribute​

present_badge: bool | None = None

Whether to apply the badge while the app is in the foreground.

None inherits the enabled initialization default. Set the badge value with badge_number; badge authorization is still required.

present_bannerclass-attributeinstance-attribute​

present_banner: bool | None = None

Whether to show a foreground banner.

None inherits the enabled initialization default.

Note

Supported only on iOS 14+ and macOS 11+.

present_listclass-attributeinstance-attribute​

present_list: bool | None = None

Whether to add a foreground notification to Notification Center.

None inherits the enabled initialization default.

Note

Supported only on iOS 14+ and macOS 11+.

present_soundclass-attributeinstance-attribute​

present_sound: bool | None = None

Whether to play sound while the app is in the foreground.

None inherits the enabled initialization default. With False and no custom sound, upstream also suppresses background notification sound. An explicit unrecognized sound name falls back to the system sound.

soundclass-attributeinstance-attribute​

sound: str | None = None

Name of a notification sound file in the app bundle.

Note

Requires present_sound. With sound presentation enabled, None uses the default notification sound. Apple limits supported file formats and custom-sound duration.

subtitleclass-attributeinstance-attribute​

subtitle: str | None = None

Secondary description displayed between the title and body.

thread_identifierclass-attributeinstance-attribute​

thread_identifier: str | None = None

Identifier used to group related notifications in Notification Center.

Notifications with the same identifier belong to the same thread.