In Android app how programmatically discover what app has started my app?
I think it should be in MyApplication that extends Application
, but it has no clues.
However inside Activity I could call getIntent()
and if the calling app is polite to give such info, I would get it via
intent.getStringExtra()
Is there general approach that would not have requirements for calling apps to provide self info?
In other app developer would call as
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 (intent)
UPDATE: I have wrote an app that launches my app and indeed the only way is to put Extra data into Intent as the intent has only "android.intent.action.MAIN"
, "android.intent.category.LAUNCHER"
and package of launched app.