onTerminateWithThreats
🔄 Event: onTerminateWithThreats
onTerminateWithThreats📘 Description
The onTerminateWithThreats event is triggered when the REL-ID SDK detects critical security threats that require immediate termination of the SDK, resulting in the app being closed on the device.
Since the SDK is already terminated at this point, the client is not required to invoke the takeActionsOnThreats API in response to this event.
Purpose
- Notifies your application about important REL-ID SDK events
- Provides critical information through event parameters
- Allows your application to respond appropriately
- Ensures proper handling of asynchronous processes\
🖥️ User Interface Requirements
When handling the onTerminateWithThreats event, mobile application developers should:
- Process the event data promptly to maintain responsiveness
- Display appropriate feedback to users based on the event data
- Implement proper error handling for any issues
- Consider both success and failure scenarios in your UI design
🧑💻 Platform Support
| Platform | Syntax |
|---|---|
| React Native | rdnaEventRegistery.addListener('onTerminateWithThreats', handler) |
| Flutter | rdnaClient.on(RdnaClient.onTerminateWithThreats, handler); |
| Cordova | document.addEventListener('onTerminateWithThreats', handler, false); |
| Native iOS | (void)onTerminateWithThreats:(NSString)threats; |
| Native Android | void onUserConsentThreats(onTerminateWithThreats status); |
📤 Response Format
React Native / Cordova
Stringify JSON array containing threat information:
[
{
"threatId": 17,
"threatName": "Developer Options",
"threatMsg": "Device is insecure, developer option is enabled.",
"threatReason": "",
"threatCategory": "SYSTEM",
"threatSeverity": "LOW",
"configuredAction": "TERMINATE",
"appInfo": {
"appName": "",
"appSha256": "",
"packageName": ""
},
"networkInfo": {
"ssid": "",
"bssid": "",
"maliciousAddress": "",
"maliciousMacAddress": ""
},
"shouldProceedWithThreats": false,
"rememberActionForSession": false
}
]Flutter
Stringify JSON array containing threat information:
[
{
"threatId": 17,
"threatName": "Developer Options",
"threatMsg": "Device is insecure, developer option is enabled.",
"threatReason": "",
"threatCategory": "SYSTEM",
"threatSeverity": "LOW",
"configuredAction": "TERMINATE",
"appInfo": {
"appName": "",
"appSha256": "",
"packageName": ""
},
"networkInfo": {
"ssid": "",
"bssid": "",
"maliciousAddress": "",
"maliciousMacAddress": ""
},
"shouldProceedWithThreats": false,
"rememberActionForSession": false
}
]Native iOS
Array of RDNAThreat objects with the following structure:
@interface RDNAThreat : NSObject
@property (nonatomic, strong) NSString threatName;
@property (nonatomic, strong) NSString threatMsg;
@property (nonatomic, strong) NSString threatReason;
@property (nonatomic, strong) NSString *threatSeverity;
@property (nonatomic, strong) NSString *threatCategory;
@property (nonatomic, strong) NSString *configured_action;
@property (nonatomic) int threatId;
@property (nonatomic) RDNAAppInfo *appInfo;
@property (nonatomic) RDNANetworkInfo *networkInfo;
@property (nonatomic) BOOL shouldProceedWithThreats;
@property (nonatomic) BOOL rememberActionForSession;
@endNative Android
Array of RDNAThreat objects with the following structure:
public class RDNAThreat {
private int threatId = 0;
private String threatName = "";
private String threatCategory = "";
private String threatMsg = "";
private String threatReason = "";
private String threatSeverity = "";
private String configuredAction = "";
private RDNAAppInfo appInfo;
private RDNANetworkInfo networkInfo;
private boolean shouldProceedWithThreats;
private boolean rememberActionForSession;
}🧩 Field Definitions
Each threat is an object with the following structure:
| Field | Type | Description |
|---|---|---|
threatId | Integer | Unique ID for the threat |
threatName | String | Name of the detected threat |
threatMsg | String | Human-readable message |
threatReason | String | Internal reason or metadata |
threatCategory | String | SYSTEM, APP, or NETWORK |
threatSeverity | String | LOW, MEDIUM, HIGH |
configuredAction | String | Usually "TERMINATE" |
shouldProceedWithThreats | Boolean | Indicates if app wants to continue despite threat |
rememberActionForSession | Boolean | Whether to remember decision for current session |
appInfo | Object | App-related info (populated for app threats) |
networkInfo | Object | Network-related info (for network threats) |
🧩 Sub-Objects
appInfo
appInfo| Field | Type | Description |
|---|---|---|
appName | String | Threatening app's name |
appSha256 | String | SHA256 hash of app |
packageName | String | App package name |
networkInfo
networkInfo| Field | Type | Description |
|---|---|---|
ssid | String | Wi-Fi SSID |
bssid | String | MAC address |
maliciousAddress | String | Malicious IP (if any) |
maliciousMacAddress | String | Malicious MAC (if any) |
📱 Platform-specific Integration
React Native
// Import the necessary modules
import RdnaClient from 'react-native-rdna-client';
// This is an event handler, not a method to call directly
// Set up event listener for onTerminateWithThreats event
let onTerminateWithThreatsSubscription = rdnaEventRegistery.addListener(
'onTerminateWithThreats', (response) => {
// Handle the response
console.log("onTerminateWithThreats event received:", response);
// Implement your logic here
}
);
// Don't forget to remove the event listener when component unmounts
componentWillUnmount() {
onTerminateWithThreatsSubscription.remove();
}Flutter
import 'package:flutter/material.dart';
import 'package:rdna_plugin/rdna_plugin.dart';
// This is an event handler, not a method to call directly
// Set up event listener for onTerminateWithThreats event
rdnaClient.on(RdnaClient.onTerminateWithThreats, onTerminateWithThreats);
// Define the callback function
void onTerminateWithThreats(RDNATerminateWithThreats response) {
// Handle the response
print("onTerminateWithThreats event received");
// Implement your logic here
}Cordova
// This is an event handler, not a method to call directly
// Set up event listener for onTerminateWithThreats event
document.addEventListener('onTerminateWithThreats', onTerminateWithThreats);
// Define the callback function
function onTerminateWithThreats(response) {
// Handle the response
console.log("onTerminateWithThreats event received:", response);
// Implement your logic here
}Native iOS
// Objective-C
// This is an event handler, not a method to call directly
// Implement the event handler method
- (void)onTerminateWithThreats:(RDNAChallengeResponse *)response {
// Handle the response
NSLog(@"onTerminateWithThreats event received");
// Implement your logic here
}
// Swift
// This is an event handler, not a method to call directly
// Implement the event handler method
func onTerminateWithThreats(_ response: RDNAChallengeResponse) {
// Handle the response
print("onTerminateWithThreats event received")
// Implement your logic here
}Native Android
// This is an event handler, not a method to call directly
// Implement the event handler method
@Override
public void onTerminateWithThreats(RDNA.RDNAChallengeResponse response, RDNAError error) {
// Handle the response
Log.d("REL-ID", "onTerminateWithThreats event received");
// Implement your logic here
}✅ What to Do Next
After receiving this event:
- Present the threat(s) to the user.
- Capture only the user's denial.
Until then, no other SDK API should be invoked.
Updated 7 days ago
