setDeviceToken

📲 REL-ID SDK API: setDeviceToken

📋 Description

The setDeviceToken API is used to register the device's push notification token (FCM, APNS, or HCM) with the REL-ID SDK. This enables the device to receive push-based verification notifications. This API must be called before the onUserLoggedIn event is triggered.


🔧 Parameters

PlatformParameterDescription
React NativedeviceTokenJSON string (for HCM) or plain string (for FCM)
FlutterdeviceTokenStringified Map for HCM or direct token for FCM/APNS
CordovadeviceTokenJSON string (for HCM) or plain string (for FCM)
iOS / Android Native❌ Not neededNative platforms auto-handle token registration

💻 Platform Usage

React Native
// FCM token
RdnaClient.setDeviceToken("<FCM_TOKEN>", (syncResponse) => {});

// HCM token
let json = {
  deviceToken: "<HCM_TOKEN>",
  pnsType: "HCM"
};
RdnaClient.setDeviceToken(JSON.stringify(json), (syncResponse) => {});
Flutter
// FCM/APNS token
rdnaClient.setDeviceToken("<TOKEN>");

// HCM token
Map<String, dynamic> token = {
  'deviceToken': "<HCM_TOKEN>",
  'pnsType': "HCM"
};
rdnaClient.setDeviceToken(token.toString());
Cordova
// FCM token
com.uniken.rdnaplugin.RdnaClient.setDeviceToken(successCallback, errorCallback, ["<FCM_TOKEN>"]);

// HCM token
let json = {
  deviceToken: "<HCM_TOKEN>",
  pnsType: "HCM"
};
com.uniken.rdnaplugin.RdnaClient.setDeviceToken(successCallback, errorCallback, [JSON.stringify(json)]);

🛑 Note

  • This API must be invoked before the onUserLoggedIn event.
  • If not called, push notifications like device verification or consent challenges will not be delivered.

✅ On Success

  • Token registered successfully.
  • Device is now ready to receive REL-ID verify notifications.

❌ On Failure

  • Ensure token format is valid.
  • Check connectivity or SDK initialization.