In an Android application, how to programmatically find out which application launched my application?
I think it should be in MyApplication, which extends Application , but it has no hints .
However, inside the operation, I could call getIntent() and if the calling application is polite to provide such information, I would get it through intent.getStringExtra()
Is there a general approach that will not have requirements for calling applications to provide their own information?
In another application, the developer would call
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.company.myapp"); startActivity(LaunchIntent);
see Launch an application from another application on Android and Open another application from your own (intentional)
UPDATE: I wrote an application that launches my application, and, indeed, the only way is to add additional data to Intent, since the intent is only "android.intent.action.MAIN" , "android.intent.category.LAUNCHER" and the package running application.
source share