Register Device for Push Notification

πŸ“² Push Notification Registration in REL-ID SDK

This guide explains how push notification token registration works in the REL-ID SDK using getDeviceToken and setDeviceToken.


🧭 Flow Summary

           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚  App receives token│◄── (from FCM, HCM, or APNS)
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚          Register with SDK          β”‚
   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
   β”‚ For React Native / Flutter / Cordovaβ”‚
   β”‚ β†’ call `setDeviceToken(token)`      β”‚
   β”‚                                     β”‚
   β”‚ For Native Android / iOS            β”‚
   β”‚ β†’ SDK calls `getDeviceToken()`      β”‚
   β”‚   app returns token                 β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β–Ό
       πŸ” Token now used for receiving
       push-based verification/auth flows

πŸ” Platform-Specific Responsibilities

PlatformSDK BehaviorApp Responsibility
React NativeDoes not auto-fetch tokenApp must call setDeviceToken() manually
FlutterDoes not auto-fetch tokenApp must call setDeviceToken() manually`
CordovaDoes not auto-fetch tokenApp must call setDeviceToken() manually`
Android NativeCalls getDeviceToken()App must override and return token
iOS NativeCalls getDeviceToken()App must override and return APNS token

πŸ’‘ When to Set the Token

  • Immediately after you receive the token from FCM (Firebase), HCM (Huawei), or APNS (Apple Push Notification Service), depending on the platform:
  • Before calling any SDK login or activation API
  • Ideally during app initialization or on user login

βœ… Outcome

Once the SDK has the device token:

  • It registers the token with REL-ID server
  • Your app can now receive push verification notifications
  • Used in flows like:
    • πŸ” Verify Authentication Challenges
    • πŸ“± Additional Device Activation
    • ⚠️ Threat Response Flows