Remote Ongoing Notifications (Android)
Android ongoing notifications are experimental. The API may change in future releases.
Voltra can apply remote updates to an ongoing notification when your app receives a push notification and handles it in a background task. This builds on the local lifecycle API — see Managing Ongoing Notifications first for creating the notification channel, requesting permission, and the start/update/stop APIs.
Server-side rendering support
Voltra provides a server-side API for converting JSX into the semantic payload used by Android ongoing notifications.
Use these APIs only in server-side or backend code. Do not import them from your React Native app runtime.
Use @use-voltra/android-server.
The main renderer APIs are:
renderAndroidOngoingNotificationPayloadToJson()returns an objectrenderAndroidOngoingNotificationPayload()returns a JSON string
This API only renders the payload. Your server still needs to send that payload through your push provider, and your app still needs a background task that calls upsertAndroidOngoingNotification() or stopAndroidOngoingNotification() when the push arrives.
Register a background notification task
You should use expo-notifications together with expo-task-manager to process real push notifications and update ongoing notifications in the background.
Register a background task early in app startup, so incoming pushes can update or stop an ongoing notification even when the app is backgrounded:
The remote update flow
The end-to-end flow is:
- Your server renders Voltra JSX into an Android ongoing-notification payload.
- Your server sends a high-priority push notification.
- The push
datacontains avoltraOngoingNotificationobject. - Your background task parses that object.
- The task calls
upsertAndroidOngoingNotification()orstopAndroidOngoingNotification().
1. Render the payload on your server
Use renderAndroidOngoingNotificationPayloadToJson() when preparing a payload on your server or in app tooling:
Then send that payload inside a push message.
If your push provider expects strings for nested payload data, use renderAndroidOngoingNotificationPayload() instead and send the JSON string directly.
2. Send the payload through your push provider
Your payload's data.voltraOngoingNotification should contain:
notificationId: the stable notification identifieroperation:'upsert'or'stop'options: start options such aschannelId,smallIcon,deepLinkUrl,requestPromotedOngoing, orfallbackBehaviorpayload: the Voltra semantic payload for'upsert'
Example Expo push request:
Voltra accepts either an object or a JSON string for data.voltraOngoingNotification. Stringifying it is often the safest option when sending through push providers.
To stop the notification remotely, send the same notificationId with operation: "stop" and omit payload.
3. Apply the payload in your background task
Channel setup for remote updates
Your background task should ensure that the target notification channel exists before calling upsertAndroidOngoingNotification(). Create the channel on startup, and also ensure it exists again inside the background handler.
