onDeviceActivated
š± Ditto ID SDK Event: onDeviceActivated
onDeviceActivatedš§ Overview
The onDeviceActivated event is emitted by the Ditto ID SDK once the device activation process is successfully completed. It signals that the device is now fully registered, trusted, and ready to participate in Ditto ID workflows.
šÆ Purpose
- Notifies the application that device activation is complete.
- Enables transition to secure areas of the app (e.g., dashboard).
- Confirms backend has registered and acknowledged the device.
š When is it Triggered?
This event is triggered after these steps have been successfully completed:
- User authentication (password/biometric)
- Device verification (via verify notification or fallback)
- Consent for LDA (optional)
- Device naming via
setDeviceName()
| Scenario | Is onDeviceActivated Triggered? | Purpose |
|---|---|---|
| ā First-Time Device Activation | āļø Yes | Confirms that the first device has been successfully activated |
| ā Additional Device Activation | āļø Yes | Confirms that a new device (not the first) is now registered and trusted |
š„ Sample Event Response
{
"errCode": 0,
"error": {
"longErrorCode": 0,
"shortErrorCode": 0,
"errorString": "Success"
},
"eMethId": 18,
"pArgs": {
"jwt": "",
"service_details": {},
"response": {
"StatusMsg": "Device activated successfully.",
"StatusCode": 100,
"CredOpMode": -1
},
"pxyDetails": {
"isStarted": 0,
"isLocalhostOnly": 0,
"isAutoStarted": 0,
"isPrivacyEnabled": 0,
"portType": 0,
"port": 0
}
}
}š§ Response Fields Explained
| Field | Description |
|---|---|
errCode | Top-level error indicator (0 = success) |
errorString | Describes success or failure |
StatusMsg | Message from server confirming activation |
StatusCode | 100 indicates success |
eMethId | Method ID for internal SDK tracking |
pxyDetails | Proxy or MTD related info (usually optional) |
š» How to Handle
| Platform | Code Sample / Listener |
|---|---|
| React Native | rdnaEventRegistery.addListener('onDeviceActivated', callback) |
| Flutter | rdnaClient.on(RdnaClient.onDeviceActivated, callback); |
| Cordova | document.addEventListener("onDeviceActivated", callback) |
| Android | Implement onDeviceActivated() event callback |
| iOS | Implement delegate onDeviceActivated() method |
ā
On Success
- Navigate user to main dashboard or post-login experience.
- Show toast/snackbar like āDevice successfully activated.ā
ā On Failure
- (Unlikely here ā failures usually occur before this stage.)
- If error fields indicate failure, show message and contact support.
Summary
onDeviceActivated = "this device is now trusted and linked to the user's Ditto ID identity", whether itās the first, second, or any subsequent device.
Updated 4 months ago
