Notifications & badges
Check authorization, request push and critical-alert permission, open settings, and set the app-icon badge.
Check notification status
Read the current notification authorization plus time-sensitive and critical-alert support. Safe to call even when those optional features are off — they report supported: false.
In a plain browser the call resolves ok: false with a code such as common/feature_disabled. Branch on !result.ok.
Ask for push permission
Read the current push authorization, then request it. granted is true for both granted and provisional. When mode is manual, show your own explainer first, then call request().
This feature can be switched off in a given app build. Check await bdk.capabilities.has("push.prompt") before showing the UI. When it is off, the call resolves ok: false with code: "common/feature_disabled". See Detect features.
Open notification settings
Send the user to the OS notification settings after a denial, or to change time-sensitive and channel options. notifications.openSettings() is the general deep-link; pass { channel: "urgent" } on Android to open the urgent channel. push.openSettings() is the same idea from the push-prompt namespace — no channel option.
Request critical alerts
Ask for Apple's separate critical-alert permission. iOS only — it does not consume the ordinary push prompt. On Android the call resolves ok: false with code: "common/unsupported_platform".
This feature can be switched off in a given app build. Check await bdk.capabilities.has("notifications.critical") before showing the UI. When it is off, the call resolves ok: false with code: "common/feature_disabled". See Detect features.
Set the app badge
Read, set, or clear the app-icon badge. iOS sets an exact count. Android set is unsupported (ok: false, code: "common/unsupported_platform"); get is an approximate count of active notifications (source: "active_notifications", approximate: true). clear works on both — on Android it reports how many cancellable notifications were removed.
Pass a finite non-negative integer to set. Check canSet() before offering a setter.
This feature can be switched off in a given app build. Check await bdk.capabilities.has("badge") before showing the UI. When it is off, the call resolves ok: false with code: "common/feature_disabled". See Detect features.
React to permission changes
Refresh status after the user answers a prompt or returns from Settings. permissions.changed fires when a tracked permission changes — not on the first snapshot — so subscribe before you call request or openSettings.