INotifications
Namespace: BlazorNative.Device
DI-injectable façade over local notifications. Inject this rather than the
low-level BlazorNative.Core.IMobileBridge; schedule, show and cancel local notifications
(a BlazorNative.Core.NotificationSpec.Route makes the tap open the app to that page) and
manage the OS permission. Every call resolves with a BlazorNative.Core.NotificationStatus
value — a denial is DATA, never an exception or a hang. Register it with
ServiceCollectionExtensions.AddBlazorNativeDevice(IServiceCollection).
public interface INotifications
Methods
ScheduleAsync(NotificationSpec, CancellationToken)
Schedules a local notification to fire at BlazorNative.Core.NotificationSpec.When
(Android AlarmManager / iOS UNCalendar-or-interval trigger, host-side). Returns
the terminal BlazorNative.Core.NotificationStatus — a denial is DATA, never a throw.
ValueTask<NotificationStatus> ScheduleAsync(NotificationSpec spec, CancellationToken ct = null)
Parameters
spec NotificationSpec
Returns
ShowAsync(NotificationSpec, CancellationToken)
Shows a local notification immediately. Returns the terminal
BlazorNative.Core.NotificationStatus — a denial is DATA.
ValueTask<NotificationStatus> ShowAsync(NotificationSpec spec, CancellationToken ct = null)
Parameters
spec NotificationSpec
Returns
CancelAsync(Int32, CancellationToken)
Cancels a shown or scheduled notification by its app-chosen id (idempotent — an unknown id is a benign no-op that still statuses).
ValueTask<NotificationStatus> CancelAsync(int id, CancellationToken ct = null)
Parameters
id Int32
Returns
RequestPermissionAsync(CancellationToken)
Requests notification permission (POST_NOTIFICATIONS on Android 13+,
UNUserNotificationCenter authorization on iOS) — MAY prompt; short-circuits to
BlazorNative.Core.NotificationStatus.Granted when already held (incl. Android's
below-API-33 implicit grant, host-side).
ValueTask<NotificationStatus> RequestPermissionAsync(CancellationToken ct = null)
Parameters
Returns
CheckPermissionAsync(CancellationToken)
Reads the current notification permission WITHOUT prompting — for a UI that wants to show state before offering a "notify me" action.
ValueTask<NotificationStatus> CheckPermissionAsync(CancellationToken ct = null)