Skip to content
This documentation is also available as markdown. For a complete index of all pages, see llms.txt at /llms.txt

Threat Detection Callback Integration

When a protected Android app detects a threat whose action is set to Callback, Doverunner Mobile App Security notifies the app in real time through an Android broadcast instead of terminating it. Your app can then respond in its own way — for example, by ending the user session, showing a warning screen, or reporting the event to your server.

Each broadcast carries two values:

  • threat_code (String) — the code that identifies the detected threat
  • timestamp (long) — the time of detection
  • The app is sealed with sealing version 3.3.0.0 or higher.
  • Callback is selected as the action for each detection you want delivered to your app — in the sealing wizard, see Threat Response Actions; with the CLI, set the matching action_* option to callback (see Threat Response Policies).
  • A broadcast receiver is registered in the app, as described in Integration Steps.
ItemValue
Actioncom.doverunner.aos.security.action.THREAT_DISCOVERED
Required permission<ProtectedAppPackage>.doverunner.permission.RECEIVE_ALERTS

Extras

KeyTypeDescription
threat_codeStringCode that identifies the detected threat. See Threat Response Codes.
timestamplongTime of detection, in milliseconds since the Unix epoch.
  1. Declare the permission in AndroidManifest.xml.

    The callback permission is generated per protected app package. Build the permission name from your app’s package name:

    ItemValue
    Format<ProtectedAppPackage>.doverunner.permission.RECEIVE_ALERTS
    Example: app packagecom.company.bank
    Example: permissioncom.company.bank.doverunner.permission.RECEIVE_ALERTS
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.company.bank">
    <!-- Replace "com.company.bank" with your app's package name -->
    <permission
    android:name="com.company.bank.doverunner.permission.RECEIVE_ALERTS"
    android:protectionLevel="signature" />
    <uses-permission android:name="com.company.bank.doverunner.permission.RECEIVE_ALERTS" />
    <application>
    ...
    </application>
    </manifest>
  2. Register the broadcast receiver.

    Register the receiver inside the <application> element and protect it with the permission declared in step 1.

    <application>
    <receiver
    android:name=".security.ThreatCallbackReceiver"
    android:exported="true"
    android:permission="com.company.bank.doverunner.permission.RECEIVE_ALERTS">
    <intent-filter>
    <action android:name="com.doverunner.aos.security.action.THREAT_DISCOVERED" />
    </intent-filter>
    </receiver>
    </application>
  3. Implement the receiver.

    The receiver reads threat_code and timestamp from the intent and passes them to your handling logic.

    package com.company.bank.security;
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.util.Log;
    public class ThreatCallbackReceiver extends BroadcastReceiver {
    private static final String TAG = "ThreatCallbackReceiver";
    private static final String ACTION_THREAT_DISCOVERED =
    "com.doverunner.aos.security.action.THREAT_DISCOVERED";
    @Override
    public void onReceive(Context context, Intent intent) {
    if (intent == null) return;
    if (ACTION_THREAT_DISCOVERED.equals(intent.getAction())) {
    String threatCode = intent.getStringExtra("threat_code");
    long timestamp = intent.getLongExtra("timestamp", 0L);
    Log.i(TAG, "Threat callback received. threat_code=" + threatCode
    + ", timestamp=" + timestamp);
    handleThreat(context, threatCode, timestamp);
    }
    }
    private void handleThreat(Context context, String threatCode, long timestamp) {
    if (threatCode == null) return;
    switch (threatCode) {
    case "D10001":
    // Example: Root detected - log out the user and invalidate the session
    break;
    case "D60007":
    // Example: Signing certificate mismatch - show a warning screen
    break;
    default:
    // Generic handling for other supported threat codes
    break;
    }
    }
    }

Use the sample app or your own build with the receiver integrated to verify that callbacks are delivered.

  1. Install the sample app, or your app build with the receiver integrated.

  2. Install the protected app, sealed with Callback selected for the detections you want to test.

  3. Trigger a supported detection — for example, launch the app on a rooted device or an emulator.

  4. Monitor the log output:

    Terminal window
    adb logcat -s ThreatCallbackReceiver

    When a callback is received, a log line similar to the following appears:

    Threat callback received. threat_code=D10001, timestamp=1720000000000
  • Callbacks are delivered only for detections whose action is set to Callback at sealing time.
  • Handle unrecognized threat_code values in a default branch, as in the sample code above.
  • Code hooking detection never triggers a callback. It always follows the default protection flow (alert, app termination, and reporting).
  • The same threat_code may be delivered more than once. Deduplicate based on threat_code and timestamp as needed.
  • Signing certificate mismatch (D60007) triggers a callback whenever the signing certificate of the installed app differs from the expected certificate.

The table below lists, for each sealing wizard option that offers Callback, the matching CLI action_* option and the threat response codes delivered in threat_code.

Sealing wizard optionCLI optionDetectsThreat response codes
Integrity Checkaction_app_integrityApp code or binary modified, or APK repackaged or re-signedD21003, D40001, D50001, D60001, D60002, D60004, D60005, D60006, D60007
Rootingaction_rootingRoot accessD10001, D10002, D10003, D14001
Developer Optionsaction_developer_optionsDeveloper options enabledD13001
USB Debuggingaction_usb_debuggingADB / USB debugging enabledD13002
Emulatorsaction_emulatorEmulator environmentD11001
Work Profile & Samsung Security Folderaction_work_profileApp running in a work profile or Samsung Secure FolderD12001
Macro Toolsaction_macroMacro automation toolsD21001, D21002, D30001, D30002, D30003, D30004
Packet Attacksaction_sniffPacket interception toolsD21001, D21002, D30001, D30002, D30003, D30004
Keyloggeraction_keyloggerKeylogger appsD21001, D21002, D30001, D30002, D30003, D30004
Overlay Windowsaction_overlayOverlay windows from other appsD60003

A sample app that demonstrates how to integrate and receive threat callbacks is available for reference and testing.

Download the sample app source code (ZIP)