Skip to content

Declared by <huxerui/system.h> in huxerui; Windows entry functions are in huxerui::windows. Shared declarations are available on every platform, but an available C++ type does not establish platform support.

Use ApplicationHandle to check, request, or open settings for a Permission. Each operation depends on the host and the application’s declarations.

Access Permission values
Camera and audio capture Camera, Microphone
Location Location accepts approximate foreground access. PreciseLocation asks for full accuracy. BackgroundLocation represents authorization beyond foreground use.
Notifications Notifications checks application-level authorization. Delivery also depends on the notification service and its configuration.
Contacts and calendars ContactsRead, CalendarAdd, CalendarReadWrite
Media library PhotosRead, VideosRead, PhotoLibraryAdd
Bluetooth BluetoothScan, BluetoothConnect
Status Meaning
NotDetermined The user has not made an authorization decision.
Granted The requested access is currently available.
Denied Access is denied and another prompt may be possible.
PermanentlyDenied The application cannot prompt again. The user can change access in Settings where available.
Restricted A system or administrative policy restricts access.
Unavailable The host or application configuration cannot provide this capability.
Provisional Authorization allows limited behavior such as quiet notification delivery.
Limited A reduced scope was granted, such as approximate access for PreciseLocation or access to selected photos.
SystemDisabled A system-wide capability switch is off. The app may still hold a grant.

PermissionSettingsTarget::Application opens the page where the user manages this application’s access. System requests the system-wide capability page. Availability depends on the specific permission and platform.

Host Key boundaries
Android Requests require manifest declarations and a live launcher. Background location uses the app permission settings on Android 11 and later. Notification authorization and channel policy are separate.
iOS and macOS Usage descriptions and applicable entitlements are application-owned. Calendar add-only requests require iOS 17 or macOS 14. The iOS settings target is app-specific. The shared macOS permission API has no settings target.
Windows Camera and microphone use AppCapability when present. Location offers a system settings target. Notification authorization depends on the registered toast identity. Windows 7 compatibility builds report unavailable.
Web Browser support determines camera, microphone, and geolocation queries. Prompts for those features come from browser acquisition APIs. Notification requests require active user interaction.
Linux Standalone permission requests are unavailable. Location authorization can be part of a platform portal session.

For the full check/request/settings matrix and platform declarations, see the framework permission contract.

LocalNotificationCapabilities reports five independent booleans: can_show, can_schedule, can_cancel, can_activate, and can_use_templates. Check the operation you intend to offer. Capabilities do not grant permission, prove a template exists, or guarantee visibility.

Field Meaning
identifier Stable nonempty application-owned UTF-8 identifier used for replacement, cancellation, and activation.
title, body StringVariant values resolved using the calling context’s effective resource configuration at submission. At least one must resolve to nonempty text.
presentation LocalNotificationPresentation: DefaultNotificationPresentation or TemplateNotificationPresentation with an identifier declared by the platform shell.
data PlatformPayload snapshot delivered to a template and returned in primary activation. Default is Null.

Identifiers and resolved text must be valid UTF-8 without embedded nulls. Data may contain scalars, owned bytes, lists, and objects; FileReference, ExternalTexture, and BufferReference are rejected recursively. Encoded HUXP data is limited to 64 KiB. Treat persisted notification data as untrusted input, not protected storage.

A template is platform-owned notification UI, not a HuxerUI View or a shared layout schema. Unsupported identifiers return Unavailable, without default-presentation fallback.

Obtain UseApplication().LocalNotifications() during composition and capture it into UI-thread events or tasks. It is application-owned; text resolves using the resource context of each Show/Schedule call, without capturing a composition Environment in the handle. Authorization requests and notification mutations preserve submission order within an application Runtime; authorization queries are independent.

The notification handle shares application authorization for Permission::Notifications where supported. Its delivery capabilities also depend on the installed transport and platform configuration. For example, the Web host can query browser notification authorization while the HuxerUI local notification transport is unavailable.

Method Return and behavior
Capabilities() Independent LocalNotificationCapabilities snapshot.
CheckAuthorizationAsync() Task of PermissionStatus, without a system prompt.
RequestAuthorizationAsync() Task of PermissionStatus after an allowed prompt or current-state query.
ShowAsync(notification) Task of LocalNotificationOperationStatus; replaces both pending and delivered entries with this identifier.
ScheduleAsync(notification, delivery_time) One-shot request at an absolute future system-clock time; replaces a pending schedule, not an already delivered notification.
CancelAsync(identifier) Cancels pending and removes delivered content; absence is an accepted no-op when cancellation is supported.

LocalNotificationOperationStatus is Accepted, Unauthorized, Unavailable, or Failed. Accepted means the system accepted the transition, not that the notification appeared. Scheduling is best effort, not an exact alarm or a guarantee across device restarts. Scheduled strings are not relocalized after acceptance.

Invalid identifiers, text, payloads, or a nonfuture delivery time throw std::invalid_argument. Supported operational failures return Failed. Retained handles remain safe after Runtime destruction but expose no capabilities and Unavailable results. Destroying a Runtime does not retract notifications already accepted by the OS.

NotificationActivation { identifier, data } is an ApplicationActivation alternative for the primary notification interaction. It enters OnActivation, including when the interaction launches the process. Dismissals and custom actions are not represented. Validate identifiers, data shape, and authorization before routing to a document or account.

See the complete notification workflow.

Call windows::RegisterLocalNotifications(app_id, display_name, activator_clsid, template_provider = {}) on the application entry thread before RunApplication on every launch, including a notification launch. Use a stable application ID and non-null braced GUID; development builds should own separate identities. Registration creates current-user identity/shortcut data and survives exit. It does not require Windows App SDK, MSIX, administrator rights, or CMake notification metadata.

UnregisterLocalNotifications(app_id, activator_clsid) explicitly cleans up the current executable’s owned identity and notifications before removal or relocation. Do not call it at ordinary exit or while the notification host is running. It does not clean other users or applications; cleanup is not transactional. Windows 7 compatibility builds do not support notification registration.

LocalNotificationTemplateProvider receives the template identifier, resolved title/body, and data synchronously on the UI thread and returns optional UTF-8 ToastGeneric XML. Return nullopt for an unknown template. Escape dynamic XML, do not block or retain borrowed arguments, and keep image paths available for delivery. The final XML including framework activation data must fit 5 KiB. The framework owns launch attributes; DTDs, external entities, custom actions/input/header elements are unsupported. Malformed output or callback exceptions produce Failed. A replacement notification is not an in-place progress update.

windows::RegisterUrlScheme(scheme, display_name) registers the current executable for the current user, normally before RunApplication. Supply a bare ASCII scheme of 2–255 characters: an initial letter followed by letters, digits, plus, minus, or dot. It does not override another executable’s ownership or the user’s default-app choice.

UnregisterUrlScheme(scheme) removes matching current-user registration before removal/relocation; absence is a no-op. Registration persists across ordinary exit and also works in the Windows 7 compatibility backend. Invalid arguments throw invalid_argument; ownership/native failures throw runtime_error. Validate every delivered URL independently of registration.

Activation explains how to route the resulting requests.