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. OOT: Winphone 7 Bisa Akses AppStore

canggih juga yak



2. Qestion about Kernel Version Runing at Android2.2

HI Folks:
   I'm tring to bring up android2.2 and now the only available kernel is at
version 2.6.27
My question here is: what will be the problem if I using kernel2.6.27 +



3. savedInstanceState null?

4. Asal Mula Maskot Hijau Android

5. Enter a number..

6. getThumbnails through droid incredible phoneStorage mount

7. Open tablet device? And whatever happened to the TI Blaze tablet?