setDeviceToken
📲 REL-ID SDK API: setDeviceToken
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
| Platform | Parameter | Description |
|---|---|---|
| React Native | deviceToken | JSON string (for HCM) or plain string (for FCM) |
| Flutter | deviceToken | Stringified Map for HCM or direct token for FCM/APNS |
| Cordova | deviceToken | JSON string (for HCM) or plain string (for FCM) |
| iOS / Android Native | ❌ Not needed | Native 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
onUserLoggedInevent. - 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.
Updated 5 months ago
