The easiest way is to use startActivityForResult(...) from application A regarding the action of application B, which must be configured using IntentFilter for use from an external application. You can also check who is calling using getCallingActivity() . You can find an example here .
Before starting an Activity, you can verify that B is installed (using the PackageManager), or you can just get started and catch the Exception.
In the called activity, you can verify the signature of the calling package using the PackageManager.checkSignature (String, String) method . Pass the package name A and B, and if the signature matches, follow the logic.
source share