Skip to main content
Supported on: iOS SDK 1.0.61+ · Android SDK 1.0.33+ · Flutter SDK 1.0.3+
The AppDNA Flutter SDK provides a complete push notification module for registering device tokens, tracking delivery and taps, and handling notification interactions through delegates and streams.

Platform Setup

Before using push notifications, complete the platform-specific setup:

iOS

  1. In Xcode, enable the Push Notifications capability under your target’s Signing & Capabilities tab.
  2. Generate an APNs authentication key (.p8 file) in the Apple Developer Portal.
  3. Upload the .p8 key to the AppDNA Console under Settings > Push > iOS Configuration.

Android

  1. Set up Firebase Cloud Messaging (FCM) in your Android project.
  2. Add the google-services.json file to your android/app/ directory.
  3. Upload the FCM server key to the AppDNA Console under Settings > Push > Android Configuration.
Without the platform-specific credentials uploaded to the AppDNA Console, push notifications will not be delivered to your users.

Push Module

Access the push module through the AppDNA.push accessor, which returns an AppDNAPushModule instance:

Request Permission

Request push notification permission from the user. This presents the system permission dialog only — it does not register for remote notifications. To register for remote notifications, call AppDNA.push.registerForPush() (see below):
The method returns a bool indicating whether the user granted permission.

Set Token Manually

If you handle token registration yourself (e.g., using firebase_messaging), pass the token string to the SDK:
Or via the static method:

Get Current Token

Retrieve the registered push token:
Returns String?null if no token has been registered.

Set Permission Status

Manually update the SDK with the current push permission status:
Or via the static method:

Track Delivery and Taps

Track when a push notification is delivered to the device:
Track when a user taps on a push notification:
These are also available as static methods:

AppDNAPushDelegate

All 3 methods on this delegate fire from the SDK’s push pipeline:
  • onPushTokenRegistered(token) — fires whenever the SDK registers a new APNs (iOS) or FCM (Android) token (or detects a change). Token registration with the AppDNA backend continues regardless of whether you implement this method.
  • onPushReceived(notification, inForeground) — fires when a push arrives. notification is the full payload map; inForeground is true when the app is active.
  • onPushTapped(notification, actionId) — fires when the user taps a notification or one of its action buttons. actionId is the identifier of the tapped action button if the user tapped one, otherwise null.
Implement the AppDNAPushDelegate abstract class to receive push notification lifecycle callbacks:

Example Implementation

AppDNAPush Helper Methods

The AppDNAPush class exposes static helpers for permission and token/tap plumbing. Push lifecycle callbacks arrive through AppDNA.push.setDelegate(...) (above) — AppDNAPush has no streams.

Notification Payload Shape

There is no public PushPayload Dart class. The notification argument delivered to the AppDNAPushDelegate callbacks is a raw Map<String, dynamic> with camelCase keys:

Auto-Tracked Events

The SDK automatically tracks the following push-related events:
Auto-tracked events are sent alongside any manually tracked events. You do not need to track these events yourself.

Full Example

Push notification behavior varies between iOS and Android. On iOS, the system permission dialog is shown on first request. On Android 13+, the POST_NOTIFICATIONS runtime permission is requested. The native SDKs handle these differences transparently.