Supported on: Android SDK
1.0.33+Prerequisites
Before using push notifications, configure FCM for your app:- Add
google-services-appdna.json(or your project’sgoogle-services.json) to yourapp/src/main/assets/directory. - Apply the
com.google.gms.google-servicesGradle plugin in your app module. - Enable Firebase Cloud Messaging in the Firebase Console.
- Upload your FCM service account credentials (or legacy server key) to the AppDNA Console under Settings > Push > Android Configuration.
Request Permission
On Android 13+ (API 33), push notifications require thePOST_NOTIFICATIONS runtime permission. Request it from a coroutine — requestPermission is a suspend function that uses the Activity Result API internally and returns a Boolean once the user responds:
onRequestPermissionsResult or call setPushPermission afterwards. On API < 33 the call is a no-op and returns true.
Java-friendly variant: AppDNA.push.requestPermissionFuture(activity): CompletableFuture<Boolean>.
Set Token Manually
Register the device push token when it is received from FCM. This is typically done in yourFirebaseMessagingService:
setPushToken and onNewPushToken perform the same operation. The token registration payload sent to the backend includes: token, platform="android", device_id, app_version, sdk_version, and os_version.
Set Permission Status
Manually update the SDK with the current push permission status:On Android 13+ (API 33), push notifications require the
POST_NOTIFICATIONS runtime permission. Call setPushPermission after the user responds to the permission request.Track Delivery and Taps
Track when a push notification is delivered to the device:action parameter is optional. Pass null if no specific action is associated with the tap.
Push Module
Access the push module directly for advanced usage:PushModule Methods
AppDNAPushDelegate
All 3 methods on this delegate fire from the SDK’s push pipeline:onPushTokenRegistered(token)— fires whenever the SDK registers a new FCM 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 interface to receive push notification lifecycle callbacks:
Example Implementation
PushPayload
ThePushPayload data class contains the notification content:
PushAction
ThePushAction data class 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
The SDK automatically handles token refresh. When FCM issues a new token via
FirebaseMessagingService.onNewToken, call AppDNA.setPushToken(token) (or AppDNA.onNewPushToken(token)) to update registration with the AppDNA backend.Next Steps
- Set up Billing to handle in-app purchases
- Configure Onboarding flows
- Present Paywalls with purchase handling
- Learn about Offline Support for event resilience

