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
userIDStringāœ…Unique 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.


**