Migration from 6.x to 7.x
This guide provides instructions for migrating from Malwarelytics Cordova Plugin version 6.x to version 7.x.
Version 7.x upgrades the native SDKs:
- Malwarelytics for Apple:
2.1.1→3.3.1 - Malwarelytics for Android:
1.2.1→1.5.2
These upgrades bring new features (screen recording detection, emulated input blocking, system screenshot detection, etc.) along with several breaking changes documented below.
Apple Platform
onCallChanged Observer Signature Change
The onCallChanged callback in MalwarelyticsAppleRASPObserver now receives a MalwarelyticsAppleCallDetection object instead of a plain boolean.
// Before (6.x)
onCallChanged(isOnCall) {
console.log("On call: " + isOnCall);
}
// After (7.x)
onCallChanged(callDetection) {
console.log("On call: " + callDetection.isOnCall);
console.log("Outgoing: " + callDetection.isOutgoing);
console.log("Incoming: " + callDetection.isIncoming);
}
New Required systemScreenshotDetected Observer Callback
MalwarelyticsAppleRASPObserver now requires a systemScreenshotDetected callback. This is triggered when iOS creates an App Switcher snapshot. Add it to your existing observer:
let observer = {
// ... existing callbacks ...
systemScreenshotDetected() {
console.log("System screenshot detected");
}
};
System screenshot detection must also be enabled in the configuration via appleConfig.raspConfig.systemScreenshot. See Configuration for details.
Android Platform
ScreenSharingDetection Data Model Changes
The ScreenSharingDetection interface has several breaking changes to match the native SDK 1.3.x update:
isScreenSharedtype changed fromnumbertoboolean.transientDatais now nullable (TransientScreenSharingData | null).transientData.displayAddedandtransientData.displayRemovedbooleans were removed and replaced by:transientData.displayChange— aDisplayChangeenum (DISPLAY_ADDITIONorDISPLAY_REMOVAL)transientData.displayId— anumberidentifying the display
- New required field
androidAutoDetection(AndroidAutoDetection) was added.
// Before (6.x)
screenSharingDetected(detection) {
if (detection.isScreenShared === 1) { /* ... */ }
if (detection.transientData.displayAdded) { /* ... */ }
}
// After (7.x)
screenSharingDetected(detection) {
if (detection.isScreenShared) { /* ... */ }
if (detection.transientData?.displayChange === "DISPLAY_ADDITION") { /* ... */ }
console.log("Android Auto:", detection.androidAutoDetection.connection);
}
screenSharing Config Shape Change
The screenSharing RASP config now uses a dedicated MalwarelyticsAndroidScreenSharingConfig with separate detectionAction and blockAction fields. The old action / exitUrl shorthand is still accepted but deprecated:
// Before (6.x)
screenSharing: { action: "NOTIFY" }
// After (7.x) — recommended
screenSharing: {
detectionAction: "NOTIFY",
blockAction: "BLOCK"
}
Migration Checklist
- Update Apple observer: change
onCallChanged(boolean)→onCallChanged(MalwarelyticsAppleCallDetection) - Update Apple observer: add
systemScreenshotDetected()callback - Update Android code reading
ScreenSharingDetection: usebooleanforisScreenShared, handle nullabletransientData, usedisplayChangeenum - Update Android
screenSharingconfig to usedetectionAction/blockAction(optional — old shape still works but is deprecated)