Skip to main content
Supported on: iOS SDK 1.0.70+ · Android SDK 1.0.42+ · React Native SDK 1.0.7+ (New Architecture only)
The AppDNA React Native SDK provides a complete push notification module for registering device tokens, tracking delivery and taps, and handling notification interactions through delegates and event listeners.

Platform Setup

Before using push notifications, configure the native push services for each platform:

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. Add your google-services.json file to the android/app directory.
  2. Upload the Firebase Server Key to the AppDNA Console under Settings > Push > Android Configuration.
Without the platform-specific push credentials uploaded to the Console, push notifications will not be delivered to your users.

Static Methods

The AppDNA class exposes top-level static methods for common push operations:

Set Token

Pass a device push token to the SDK manually:

Set Permission Status

Update the SDK with the current push permission status:

Track Delivery

Track when a push notification is delivered to the device:

Track Tap

Track when a user taps on a push notification, with an optional action identifier:

Push Module

Access the push module through the AppDNA.push property for advanced usage:

Module Methods

Request Permission

Request push notification permission from the user. This presents the system permission dialog:

Get Current Token

Retrieve the current device push token:

AppDNAPushDelegate

Set a delegate to receive push notification lifecycle callbacks:

Example Implementation

Standalone AppDNAPush Class

For a more React-idiomatic approach, use the standalone AppDNAPush class with callback-based listeners:

Methods

Example with Listeners

Always call the unsubscribe function returned by onPushReceived and onPushTapped when the component unmounts to prevent memory leaks.

PushPayload

The PushPayload type contains the notification content. The keys are snake_case — they are the keys native puts on the wire, not camelCase: Each entry in actions is a PushAction:

Native events

Native emits the following to the push delegate:
Use AppDNAPush or AppDNA.push.setDelegate(...). There is no supported way to subscribe to these events directly, and a NativeEventEmitter subscription would never fire.

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