android - How to get the package name of an external app which calls my app -
my app com.test.sample invoked external app com.testexternal.outsideapp. external app uses intent invoke mainactivity of com.test.sample calling startactivityforresult. looking way programmatically obtain package name of external app. tried several ways
string parentpackagename = this.getparent().getpackagename();
//this fails since parent returning null.
string packagename = this.getintent().getpackage();
//this returns package name of current application not want.
is there other way package name of caller app?
you can if application started activity#startactivityforresult
using activity#getcallingactivity()
.
Comments
Post a Comment