Supported on: iOS SDK
1.0.61+ · Android SDK 1.0.33+ · Flutter SDK 1.0.3+Platform Setup
Before using push notifications, complete the platform-specific setup:iOS
- In Xcode, enable the Push Notifications capability under your target’s Signing & Capabilities tab.
- Generate an APNs authentication key (.p8 file) in the Apple Developer Portal.
- Upload the .p8 key to the AppDNA Console under Settings > Push > iOS Configuration.
Android
- Set up Firebase Cloud Messaging (FCM) in your Android project.
- Add the
google-services.jsonfile to yourandroid/app/directory. - Upload the FCM server key to the AppDNA Console under Settings > Push > Android Configuration.
Push Module
Access the push module through theAppDNA.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, callAppDNA.push.registerForPush() (see below):
bool indicating whether the user granted permission.
Set Token Manually
If you handle token registration yourself (e.g., usingfirebase_messaging), pass the token string to the SDK:
Get Current Token
Retrieve the registered push token:String? — null if no token has been registered.
Set Permission Status
Manually update the SDK with the current push permission status:Track Delivery and Taps
Track when a push notification is delivered to the device: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.notificationis the full payload map;inForegroundistruewhen the app is active.onPushTapped(notification, actionId)— fires when the user taps a notification or one of its action buttons.actionIdis the identifier of the tapped action button if the user tapped one, otherwisenull.
AppDNAPushDelegate abstract class to receive push notification lifecycle callbacks:
Example Implementation
AppDNAPush Helper Methods
TheAppDNAPush 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 publicPushPayload 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.
