Feature SDKs (Free)
local_notification_display Free
- Tier
- Freeversion 0.1.4
- Command
archipelago generate local_notification_display- Generates
infrastructure/local_notification_display
- Generates first
- push_notification_sdkwhen needed and missing, so there is nothing to install first
Local notification display for
push_notification_sdk. Defers marketing pushes out of quiet hours and shows sensitive pushes with lock-screen-safe content.
It does two jobs:
- Deferral. A marketing push that arrives in the user's quiet hours is scheduled for the end of quiet hours instead of being dropped.
- Lock-screen-safe display. A sensitive foreground push (
publicTitle != null) gets no vendor banner. This package posts it.
Without this brick the push policy drops quiet-hours marketing, as before.
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
isForMonorepo | boolean | true | Whether to integrate with the monorepo workspace. |
Generated package
infrastructure/local_notification_display/:LocalNotificationDisplay(implementsDeferredNotificationDisplayfrompush_notification_api) andLocalNotificationDisplayPackageModule.
Usage
archipelago generate local_notification_displayThe brick generates push_notification_sdk first when it is missing. It needs push_notification_sdk 1.3.1 or later; pre_gen stops with a message if the installed SDK is older.
post_gen:
- adds the package to the workspace and the app pubspec;
- registers
LocalNotificationDisplayPackageModuleafterPushNotificationGlobalModule(depends_on: [push_notification_impl]); - adds the
flutter_local_notificationsscheduled-notification receivers andRECEIVE_BOOT_COMPLETEDtoandroid/app/src/main/AndroidManifest.xml.
No code is needed in the app. To remove the behaviour, remove the module from the injector.
How deferral works
DefaultNotificationPolicyreturnsSuppressNotification(quietHours)for marketing inside quiet hours.- If the message would pass every other rule (consent, cap), the policy calls
DeferredNotificationDisplay.deferwith the message (redacted if sensitive) and the quiet hours. LocalNotificationDisplayschedules it at the next quiet-hours end in the device time zone. The time is wall-clock: a 07:00 end stays 07:00 across DST changes. An end inside a DST gap moves to the first valid time.- A scheduled message counts against the marketing cap when it is scheduled.
Android uses inexactAllowWhileIdle, so no exact-alarm permission is needed and the message can arrive a few minutes late. Scheduled messages survive a reboot through the boot receiver.
Lock screen
| Platform | Shown text | Lock screen |
|---|---|---|
| Android | title / body | NotificationVisibility.private: the system hides the content on a secure lock screen. flutter_local_notifications has no custom publicVersion, so publicTitle is not used as the lock-screen text. |
| iOS | publicTitle / publicBody | iOS has no per-notification redaction, so the safe text is the notification. |
Limits
- Foreground only. The device policy runs only when the app receives the message (foreground). Background and terminated deliveries are shown by the OS without the policy, so they are neither deferred nor redacted. Senders must keep those safe server-side.
- Taps. Tapping a local notification opens the app; it does not emit on
PushNotificationSDK.tapStream. The route is in the notification payload. - Consent at display time. Consent is checked when the message arrives, not when the scheduled notification fires.
- Channels. Android channels are per tier:
Alerts,Updates,Promotions(LocalNotificationDisplay.channelNames). Rename them in the generated code to localise.
See the notification policy section of push_notification_sdk.