Skip to main content
Supported on: iOS SDK 1.0.61+
The AppDNA SDK provides a complete push notification module for registering device tokens, handling notification delivery, and tracking user interactions.

APNs Setup

Before using push notifications, configure Apple Push Notification service (APNs) for your app:
  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.
Without the APNs capability enabled and the .p8 key uploaded to the Console, push notifications will not be delivered to your users.

Request Permission

Request push notification permission from the user. This presents the system permission dialog and registers for remote notifications:
The method returns a Bool indicating whether the user granted permission.

Set Token Manually

If you handle token registration yourself (e.g., in application(_: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:
Track when a user taps on a push notification:

Push Module

Access the push module directly for advanced usage:
On iOS the host-facing property is AppDNA.pushModule (Swift); Android, Flutter, and React Native expose the same surface as AppDNA.push. The behavior and methods are identical — only the namespace name differs. (On iOS there is also an internal AppDNA.push accessor for the lower-level PushTokenManager, but it is not part of the public API and hosts do not call it.)

PushModule Methods

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.
Implement the AppDNAPushDelegate protocol to receive push notification lifecycle callbacks:

Example Implementation

PushPayload

The PushPayload struct contains the notification content:

PushAction

The PushAction struct defines the action associated with a notification tap:

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

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.