简体   繁体   中英

Get application name which invoked the intent in android

I have two apps, say App A and App B, App A call tries to invoke a service in App B using intent, I don't want to allow App A if it does not belong to a certain list of allowed app names, is there a way to find out the name of the app which is calling my service in App B.

PS: I am using AIDL bound service to communicate between the two apps, App A has an activity that calls upon service in App B, getReferrer() is not available in service, I have checked with API level 22 also.

If you are using AIDL you can define your service so that it receives a name or secret key and check if the client is valid then respond to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM