0

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.

Vikram
  • 714
  • 1
  • 5
  • 10
  • You could try to use a `referrer` (since API 22) as mentioned in [this answer to a similar question](https://stackoverflow.com/a/67552933/1712135)… – deHaar Aug 01 '22 at 06:51
  • @deHaar I have updated my question, can u please suggest a solution for this, I am trying to access it inside a service and there is no getReferrer functionality available in there. – Vikram Aug 01 '22 at 07:20
  • Are you an owner of both apps? – Oleksii K. Aug 01 '22 at 07:23
  • @OleksiiK. , I own only App B, I need package name of caller(App A) for security purposes – Vikram Aug 01 '22 at 07:30

1 Answers1

0

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.

Alireza Barakati
  • 1,016
  • 2
  • 9
  • 23