Skip to content
Back to archipelago.banuacoder.com

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 ​

VariableTypeDefaultDescription
isForMonorepobooleantrueWhether to integrate with the monorepo workspace.

Generated package ​

  • infrastructure/local_notification_display/: LocalNotificationDisplay (implements DeferredNotificationDisplay from push_notification_api) and LocalNotificationDisplayPackageModule.

Usage ​

bash
archipelago generate local_notification_display

The 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 LocalNotificationDisplayPackageModule after PushNotificationGlobalModule (depends_on: [push_notification_impl]);
  • adds the flutter_local_notifications scheduled-notification receivers and RECEIVE_BOOT_COMPLETED to android/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 ​

  1. DefaultNotificationPolicy returns SuppressNotification(quietHours) for marketing inside quiet hours.
  2. If the message would pass every other rule (consent, cap), the policy calls DeferredNotificationDisplay.defer with the message (redacted if sensitive) and the quiet hours.
  3. LocalNotificationDisplay schedules 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.
  4. 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 ​

PlatformShown textLock screen
Androidtitle / bodyNotificationVisibility.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.
iOSpublicTitle / publicBodyiOS 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.