Get Device ID
š± Ditto ID SDK API Documentation: getDeviceID
š Overview
The getDeviceID API provides a unique identifier for the device on which the SDK is currently running. This device ID is useful for device-level authentication, session tracking, and encryption scope.
šÆ Purpose
Use this API to:
- Retrieve a consistent and unique identifier for the device.
- Tie authentication tokens or cryptographic operations to a specific device.
- Enable device-level tracking, audit logging, or access control.
š API Flow
- Ensure the SDK is initialized.
- Call
getDeviceID(). - Use the returned device ID string where needed.
š§¾ Response
Returns the device ID as a String value.
š§ Example Response:
{
"response": "2JUW5N1Z92XK3CSJY3QWB26IY2W5AV529DICH6C12SD7W245U2",
"error": {
"shortErrorCode": 0,
"longErrorCode": 0,
"errorString": "Success"
}
}
š» Code Snippets
React Native
RdnaClient.getDeviceID((response) => {
const deviceId = response.response;
});Flutter
final deviceId = await rdnaClient.getDeviceID();Cordova
com.uniken.rdnaplugin.RdnaClient.getDeviceID(successCallback, errorCallback);Native iOS
NSString* deviceId = [rdnaClient getDeviceID];Native Android
String deviceId = rdnaClient.getDeviceID();ā ļø Error Codes
| Code | Error | Action |
|---|---|---|
| 0 | Success | Use the returned value |
| 4 | RDNA_ERR_INVALID_ARGS | Ensure SDK is initialized |
| 88 | RDNA_ERR_RDNA_ALREADY_INITIALIZED | Typically safe, may ignore |
š§ Developer Notes
- The device ID is tied to the device and should remain consistent unless the app or device is reset.
- For cryptographic operations, pair with
privacyScope = DEVICE. - Should not be confused with session ID or user ID.
š End of Documentation
Updated 4 months ago
