Terminate SDK
🛑 REL-ID SDK API: terminate
terminate
📋 Description
The terminate
API is used to gracefully shut down the REL-ID SDK runtime. It should be invoked during application shutdown or logout to clean up the session and internal contexts. Once called, the SDK will emit the onTerminate
event with the termination status. Use terminate()
to maintain session integrity and avoid residual memory issues during logout or app kill operations.
🔧 Usage
🧾 Parameters
Platform | Parameters | Description |
---|---|---|
Cordova | successCallback, errorCallback | Sync callbacks for result handling |
Others | None | Terminate is a no-arg method on other platforms |
💻 Platform Examples
React Native
RdnaClient.terminate((syncResponse) => {
console.log("Termination Status:", syncResponse);
});
Flutter
await rdnaClient.terminate();
Cordova
com.uniken.rdnaplugin.RdnaClient.terminate(successCallback, errorCallback);
iOS (Objective-C)
RDNAError *error = [client terminate];
Android
RDNAError error = rdnaClient.terminate();
🛑 REL-ID SDK Event: onTerminate
onTerminate
📋 Description
The onTerminate
event is triggered by the SDK after calling the terminate()
API. This event reports the outcome of the SDK shutdown process and can also include any permission-related messages that the application may need to handle.
🧭 When It’s Triggered
- Immediately after calling the
terminate()
API. - It provides confirmation of whether termination was successful or not.
📤 Sample Payload
{
"errCode": 0,
"error": {
"longErrorCode": 0,
"shortErrorCode": 0,
"errorString": "Success"
},
"eMethId": 2
}
📄 Response Fields
Field | Type | Description |
---|---|---|
errCode | Int | General error code |
error | Object | Contains longErrorCode, shortErrorCode, message |
eMethId | Int | Method ID that maps to terminate() |
💻 Platform Usage
React Native
let onTerminateSubscription = rdnaEventRegistery.addListener(
"onTerminate",
this.onTerminate.bind(this)
);
Flutter
rdnaClient.on(RdnaClient.onTerminate, (response) {
print("Terminate status: ${response.error.errorString}");
});
Cordova
document.addEventListener("onTerminate", function(event) {
console.log("Termination event:", event);
}, false);
iOS (Objective-C)
- (int)onTerminate:(RDNAStatusTerminate *)status {
NSLog(@"Terminate Status: %@", status.error.errorString);
}
Android
int onTerminate(RDNAStatusTerminate status) {
Log.i("Terminate Status", status.getError().getErrorString());
return 0;
}
✅ On Success
- SDK runtime is cleanly terminated.
- App can safely close or reinitialize SDK later.
❌ On Failure
- Log or show the error message to the user.
- Retry termination if necessary.
- Check the
errorString
andshortErrorCode
from the response. - Common causes include SDK not initialized or internal context issues.
Updated 3 months ago