Setting Device Name
🧭 Overview - getDeviceName
Event
getDeviceName
EventThe REL-ID SDK triggers the getDeviceName
event during during user activation or device registration when a new device is being activated or registered. It expects the mobile app to respond by prompting the user for a friendly device name and then call the setDeviceName
API with the chosen name.
This process helps identify and manage multiple devices linked to the same user account in the REL-ID platform.
🎯 Purpose
- 🔐 To associate a user-friendly name with the current device
- 📱 To help users identify their devices during multi-device scenarios
- 🛠️ Typically used in the first-time login or new device activation flow
📱 UI Guidance
Present a screen asking the user to enter or confirm a device name. REL-ID SDK provides an autoGeneratedDeviceName
which can be displayed as a suggestion.
Recommended UI elements:
- Editable text input field pre-filled with
autoGeneratedDeviceName
- Confirm button
- Optional: Info icon or help message about why device name is needed
📥 Sample Payload
{
"userID": "testuser",
"autoGeneratedDeviceName": "Android_MiA2_112919193803",
"challengeResponse": {
"status": {
"statusCode": 100,
"statusMessage": ""
},
"session": {
"sessionType": 0,
"sessionID": "<SESSION_ID>"
},
"additionalInfo": {
"DNAProxyPort": 0,
"isAdUser": 0,
"isDNAProxyLocalHostOnly": 0,
"JWT": ""
},
"challengeInfo": []
},
"error": {
"longErrorCode": 0,
"shortErrorCode": 0,
"errorString": "Success"
}
}
🔑 Relevant Fields
Field | Description |
---|---|
userID | Username associated with the login |
autoGeneratedDeviceName | Suggested device name generated by SDK |
session.sessionID | Unique session ID |
error.shortErrorCode | Indicates if there's any error |
📲 API: setDeviceName
setDeviceName
This API is used to respond to the getDeviceName
event with the chosen device name. Once the user enters the device name, call the setDeviceName
API to send it back to the SDK
📥 Input
Parameter | Type | Required | Description |
---|---|---|---|
deviceName | String | ✅ | Device name provided by the user |
💻 Platform-Specific Usage
React Native
RdnaClient.setDeviceName("Aditya's Pixel 6", (syncResponse) => {
console.log("Device name set status:", syncResponse);
});
Flutter
rdnaClient.setDeviceName("Aditya's iPad");
Cordova
com.uniken.rdnaplugin.RdnaClient.setDeviceName(
() => console.log("Device name set"),
(err) => console.error("Error setting name", err),
["Aditya's Device"]
);
Native Android
RDNAError error = rdna.setDeviceName("Aditya's Galaxy");
Native iOS
[client setDeviceName:@"Aditya's iPhone"];
❗ Error Handling
Common Errors
Short Code | Error Enum | Description | Suggested Action |
---|---|---|---|
4 | RDNA_ERR_INVALID_ARGS | Invalid or missing device name | Prompt user and retry |
17 | RDNA_ERR_SERVICE_NOT_SUPPORTED | Feature unsupported | Skip or contact support |
52 | RDNA_ERR_FAILED_TO_OPEN_HTTP_CONNECTION | Network issues | Retry |
116 | RDNA_ERR_CIS_CONFIGURATION_INVALID | Server misconfiguration | Contact admin |
131 | RDNA_ERR_STEPUP_AUTH_LDA_BIOMETRIC_CANCELLED_BY_USER | Biometric prompt cancelled | Allow retry or fallback |
On Success
- Proceed to the next authentication step such as
addAlternateLoginId
- Store/display device name locally if needed
On Failure
- Retry or fallback to suggested
autoGeneratedDeviceName
- Provide error message to user
_
Updated 3 months ago