How to know the caller of ContentProvider

by James Wang » Thu, 17 Dec 2009 18:31:27 GMT

Sponsored Links
 We are developing a ContentProvider which is supposed to serve for
specified packages. So we want to get the caller package name. Is
there any way to achieve that?

Thanks in advanced.



How to know the caller of ContentProvider

by James Wang » Fri, 18 Dec 2009 09:12:50 GMT

 We got a solution here:
int pid = Binder.getCallingPid();

And pass the pid to getProcessNameFromPid below:

private String getProcessNameFromPid(int givenPid) {
ActivityManager am = (ActivityManager)

List<ActivityManager.RunningAppProcessInfo> lstAppInfo =

for(ActivityManager.RunningAppProcessInfo ai : lstAppInfo) {
if ( == givenPid) {

return ai.processName;
return null;

I wonder whether there is any other way to do it.


Sponsored Links

Other Threads

1. Paging adityo

Maaf numpang jalum
Bro tyo di hub nyaut

Gtalk ye

Thanks mods
sent by jave aka jupe

"Indonesian Android Community [id-android]" 

2. OOT:alternatif IPad

moga2 tidak repost,,
ada yang mau siap2 nabung mulai sekarang?
*tidur lagi ahhh*

"Indonesian Android Community [id-android]" 

3. permission denied on devce

4. SMSan di Android?

5. aPad/iRobot 2nd generatio

6. ask : download manager yang bagus

7. Help : Gmail amplop merah gak bisa save attachment