Customization of MTD Threat Messages
📌 Purpose
When the SDK detects threats and raises the onUserConsentThreats
or onTerminateWithThreats
events, your app may display user-friendly threat messages. This customization is implemented by overriding the default messages with application-specific messages.
⚙️ API Pattern
Each platform should define a helper function to return a custom threat message for a given threatName
.
🧪 Sample Implementation
React Native
getCustomizedThreatMessage = (threatName, defaultThreatMsg) => {
switch (threatName) {
case 'App From Unknown Source':
return "This app isn't from an official source. Please install from Play Store.";
case 'Blacklisted App':
return "A blacklisted app was detected. Please uninstall it to continue.";
default:
return defaultThreatMsg;
}
};
Flutter
String getCustomizedThreatMessage(String threatName, String defaultThreatMsg) {
switch (threatName) {
case 'App From Unknown Source':
return "This app isn't from an official source. Please install from Play Store.";
case 'Blacklisted App':
return "A blacklisted app was detected. Please uninstall it to continue.";
default:
return defaultThreatMsg;
}
}
Cordova
function getCustomizedThreatMessage(threatName, defaultThreatMsg) {
switch (threatName) {
case 'App From Unknown Source':
return "This app isn't from an official source. Please install from Play Store.";
case 'Blacklisted App':
return "A blacklisted app was detected. Please uninstall it to continue.";
default:
return defaultThreatMsg;
}
}
Native iOS (Swift)
func getCustomizedThreatMessage(threatName: String, defaultThreatMsg: String) -> String {
switch threatName {
case "App From Unknown Source":
return "This app isn't from an official source. Please install from App Store."
case "Blacklisted App":
return "A blacklisted app was detected. Please uninstall it to continue."
default:
return defaultThreatMsg
}
}
Native Android (Kotlin)
fun getCustomizedThreatMessage(threatName: String, defaultThreatMsg: String): String {
return when (threatName) {
"App From Unknown Source" -> "This app isn't from an official source. Please install from Play Store."
"Blacklisted App" -> "A blacklisted app was detected. Please uninstall it to continue."
else -> defaultThreatMsg
}
}
📝 Notes
- Use
threatName
(not threat ID) for mapping. - The actual
threatName
strings (e.g.,"App From Unknown Source"
) should match names from your REL-ID MTD Config. - Call this function when rendering the threat message in your app's UI.
Updated 2 months ago