Update Device Details

🧭 Overview - updateDeviceDetails API

The updateDeviceDetails API is used to manage user devices retrieved from the onGetRegisteredDeviceDetails callback. It is used to modify registered device metadata like name or status (e.g., marking a device as deleted). After the API is called, the SDK responds with the onUpdateDeviceDetails event, confirming whether the update was successful.

🎯 Purpose

  • ✏️ Rename a registered device.
  • ❌ Remove (delete) a registered device.
  • 🔁 Reflect changes on the server immediately for future authentication checks.

🖥️ UI Screen Requirements

App developers must provide a "Manage My Devices" screen where users can:

  • View and select devices.
  • Edit the device name.
  • Delete old or unused devices.

Recommended UI components:

  • Editable text field for name
  • Save button to apply changes
  • Delete/trash icon with confirmation prompt

🔁 API: updateDeviceDetails

🔧 Description

Updates registered device information for the specified user.

📥 Parameters

NameTypeRequiredDescription
userIDStringUnique user identifier
deviceListString (JSON)JSON string containing device info

🔄 Corresponding Event

✅ Result is received via onUpdateDeviceDetails event.


📩 Sample Request Payload for React Native, Flutter and Cordova

{
  "device": [
    {
      "devUUID": "ABC123XYZ456",
      "devName": "My Updated Phone",
      "status": "Update",
      "lastAccessedTs": "2024-04-30T07:15:30UTC",
      "createdTs": "2024-04-28T09:10:10UTC",
      "lastAccessedTsEpoch": "1714463730",
      "createdTsEpoch": "1714291810",
      "appUuid": "unique-app-id",
      "devBind": 0
    }
  ]
}

🔁 Status Values and Effects for React Native, Flutter and Cordova

ValueMeaningUI Behavior
UpdateRename/updateApply changes immediately
DeleteDelete deviceRemove from list (if not current device)

💻 Code Snippets

React Native
const payload = {
  device: [{
    devUUID: "ABC123XYZ456",
    devName: "Updated Device",
    status: "Update",
    lastAccessedTs: "2024-04-30T07:15:30UTC",
    createdTs: "2024-04-28T09:10:10UTC",
    lastAccessedTsEpoch: "1714463730",
    createdTsEpoch: "1714291810",
    appUuid: "unique-app-id",
    devBind: 0
  }]
};

RdnaClient.updateDeviceDetails("user123", JSON.stringify(payload), (syncResponse) => {
  console.log("Update sent");
});
Flutter
final payload = {
  "device": [
    {
      "devUUID": "ABC123XYZ456",
      "devName": "Updated Device",
      "status": "Update",
      "lastAccessedTs": "2024-04-30T07:15:30UTC",
      "createdTs": "2024-04-28T09:10:10UTC",
      "lastAccessedTsEpoch": "1714463730",
      "createdTsEpoch": "1714291810",
      "appUuid": "unique-app-id",
      "devBind": 0
    }
  ]
};

rdnaClient.updateDeviceDetails("user123", jsonEncode(payload));
Cordova
const payload = {
  device: [{
    devUUID: "ABC123XYZ456",
    devName: "Updated Device",
    status: "Update",
    lastAccessedTs: "2024-04-30T07:15:30UTC",
    createdTs: "2024-04-28T09:10:10UTC",
    lastAccessedTsEpoch: "1714463730",
    createdTsEpoch: "1714291810",
    appUuid: "unique-app-id",
    devBind: 0
  }]
};

com.uniken.rdnaplugin.RdnaClient.updateDeviceDetails(
  () => console.log("Update success"),
  (err) => console.error("Update failed", err),
  ["user123", JSON.stringify(payload)]
);
Native Android

🔄 Update Device Name

To update the name of a device:

devices[index].setNewDeviceName("New_Device_Name");
  • devices[index]: Access a specific device object.
  • setNewDeviceName: Assigns a new name to the device.

🗑️ Delete Device

To delete a device:

devices[index].deleteDevice();
  • Deletes the device from the registered list.
Native iOS

🔄 Update Device Name

To update the name of a device:

[devices[index] setDeviceName:@"New_Device_Name"];
  • devices[index]: Access a specific device from the array.
  • setDeviceName: Sets a new name for the device.

🗑️ Delete Device

To delete a device:

[devices[index] deleteDevice];
  • Removes the selected device from the user's account.



onUpdateDeviceDetails Event

The onUpdateDeviceDetails event is emitted by the REL-ID SDK in response to the updateDeviceDetails API call. This event is triggered when the update operation completes.

📩 Sample Payload onUpdateDeviceDetails

{
  "errCode": 0,
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  },
  "eMethId": 13,
  "pArgs": {
    "jwt": "",
    "service_details": {},
    "response": {
      "StatusMsg": "Success.",
      "StatusCode": 100,
      "CredOpMode": -1
    },
    "pxyDetails": {
      "isStarted": 0,
      "isLocalhostOnly": 0,
      "isAutoStarted": 0,
      "isPrivacyEnabled": 0,
      "portType": 0,
      "port": 0
    }
  }
}

🔑 Payload Fields

FieldDescription
errCode0 on success, non-zero on failure
errorStringMessage like "Success" or error reason
StatusCode100 on success
StatusMsgDescriptive message of outcome

Code snippets

React Native
// Subscribe to the device update event
let onUpdateDeviceDetailsSubscription = rdnaEventRegistery.addListener(
  'onUpdateDeviceDetails',
  this.onUpdateDeviceDetails.bind(this)
);

Flutter
// Listen to the device update callback
rdnaClient.on(RdnaClient.onUpdateDeviceDetails, onUpdateDeviceDetails);

void onUpdateDeviceDetails(RDNAStatusUpdateDeviceDetails response) {
  // handle updated device details
}

Cordova
// Event listener for device update
document.addEventListener(
  'onUpdateDeviceDetails',
  this.onUpdateDeviceDetails.bind(this),
  false
);

Native iOS (Objective-C)
// Pseudocode for iOS callback method
(int)onUpdateDeviceDetails:(RDNAStatusUpdateDeviceDetails *)status {
  // handle updated device info
}

Native Android (Java)
// Pseudocode for Android callback method
int onUpdateDeviceDetails(RDNAStatusUpdateDeviceDetails status) {
  // handle updated device info
  return 0;
}

✅ On Success

  • Show a confirmation message: “Device updated successfully.”
  • Refresh device list via getRegisteredDeviceDetails.

❌ On Failure

  • Show error message.
  • Option to retry or cancel.
  • If response contains a StatusCode != 100, treat as failure.


**