Supported on: iOS SDK
1.0.61+APNs Setup
Before using push notifications, configure Apple Push Notification service (APNs) for your app:- 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.
Request Permission
Request push notification permission from the user. This presents the system permission dialog and registers for remote notifications:Bool indicating whether the user granted permission.
Set Token Manually
If you handle token registration yourself (e.g., inapplication(_:didRegisterForRemoteNotificationsWithDeviceToken:)), pass the raw token data to the SDK:
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:Push Module
Access the push module directly for advanced usage:On iOS the property name is
AppDNA.pushModule (Swift); Android, Flutter, and React Native use AppDNA.push. The behavior and methods are identical — only the namespace name differs to avoid a collision with AppDNA.push which on iOS returns the lower-level PushTokenManager.PushModule Methods
| Method | Signature | Description |
|---|---|---|
requestPermission | requestPermission() async -> Bool | Request push permission and register for remote notifications |
token | token: String? | The current APNs device token as a hex string |
getToken | getToken() -> String? | Returns the current device token |
setDelegate | setDelegate(_ delegate: AppDNAPushDelegate?) | Set a delegate for push notification callbacks |
AppDNAPushDelegate Protocol
All 3 methods on this delegate fire from the SDK’s push pipeline:onPushTokenRegistered(token:)— fires whenever the SDK registers a new APNs 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.onPushTapped(notification:, actionId:)— fires when the user taps a notification or one of its action buttons.
AppDNAPushDelegate protocol to receive push notification lifecycle callbacks:
Example Implementation
PushPayload
ThePushPayload struct contains the notification content:
| Property | Type | Description |
|---|---|---|
pushId | String | Unique identifier for the notification |
title | String | Notification title |
body | String | Notification body text |
imageUrl | String? | URL to a rich notification image |
data | [String: Any]? | Custom data payload |
action | PushAction? | Action to perform when tapped |
PushAction
ThePushAction struct defines the action associated with a notification tap:
| Property | Type | Description |
|---|---|---|
type | String | Action type (e.g., “deep_link”, “url”, “screen”) |
value | String | Action value (e.g., a URL or screen identifier) |
Auto-Tracked Events
The SDK automatically tracks the following push-related events:| Event | Triggered When |
|---|---|
push_token_registered | Device token is successfully registered |
push_permission_granted | User grants push permission |
push_permission_denied | User denies push permission |
push_delivered | A push notification is delivered |
push_tapped | User taps on a push notification |
Auto-tracked events are sent alongside any manually tracked events. You do not need to track these events yourself.
Full Example
For Notification Service Extension support (rich notifications, delivery tracking in background), see the Offline Support guide for details on how events are queued and delivered.

