Push Notification Workflow
🔧 Integration Flow Summary
1. Pre-requisites
- Use Firebase Cloud Messaging (FCM) for Android and Apple Push Notification Service (APNS) for iOS.
- Register the app with these services.
- Retrieve the device token and implement push handling logic.
2. Sending Device Token to REL-ID SDK
Native Android and Native iOS
- Upon app launch, REL-ID SDK invokes a method
getDeviceToken
to get the device token. - Implement
getDeviceToken()
in native Android/iOS
Flutter, Cordova, React Native
- Developers must capture token from FCM/APNS.
- Pass it to REL-ID SDK using
setDeviceToken
API - It is crucial to call setDeviceToken before the onUserLoggedIn event is triggered.
3. Receive the Push “Tickle”
When your app (or the device) gets a push notification “tickle” (a small signal indicating there’s new information), the mobile OS displays it in the notification tray. On tapping on the notification or if the app is already active, trigger the getNotifications API provided. This API retrieves the notification.
4. Display the Notifications
The application can display notification details only after receiving a callback
with the notification details. Also inside the app on successfully receiving the notification data, the app can use it to update badges or notification counts as required.
5. Update Notification with User Action
API:
updateNotification(notificationID, response)
Callback:
onUpdateNotification()
Used to remove handled notification or refresh the list.
5. View Historical Notifications
API:
getNotificationHistory(recordCount, enterpriseID, startIndex, startDate, endDate, status, actionPerformed, keywordSearch, deviceID)
Callback:
onGetNotificationHistory()
Displays archived or previously handled notifications.
🎯 Use Cases
App State | Expected Behavior |
---|---|
App Not Running | Show notification in tray. On tap, launch the app. If the user is logged in, display notification details immediately. Otherwise, prompt login first, then show details. |
App in Background | Show notification in tray. On click, bring app to foreground and show details. If the user is logged in, show details immediately. Otherwise, prompt login first, then show details. |
App in Foreground | Do not show in tray. Directly display notification details if user is logged in. |
Fetching Notification On User Interaction | As Push notification is just a doorbell to the device, we recommend providing a "bell" icon inside the app to fetch the notifications. If the user clicks on the "bell" icon, the notification details should be fetched and displayed. |
Updated about 2 months ago