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