In the onBind()
method of a service I'd like to check whether the caller has a particular permission. For that I need to find the identity of the caller.
I expected the following code to return the caller package name but instead I get the package name of the service. What am I doing wrong?
Binder.getCallingUid()
String pkg = getPackageManager().getNameForUid(uid);