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.

James

--



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)
getContext().getSystemService(Activity.ACTIVITY_SERVICE);

List<ActivityManager.RunningAppProcessInfo> lstAppInfo =
am.getRunningAppProcesses();

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

return ai.processName;
}
}
return null;
}

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

--


Sponsored Links


Other Threads

1. Kumpulan Android Ebook

http://forum.android.or.id/showthread.php?4210-Kumpulan-Android-Ebook

-- 
===============

2. Image manipulation at high level

Hi,

I'm looking for any lib that allows me to apply some effects to images from
my android app. There are different effects I would like to apply, from
color filtering (ok, that's easy) to a "polarized" effect (adding the frame
around the image). I'll love to be able to use ImageMagick in Android but I
think that's not possible.

Do you guys know any lib I could use to do a high level manipulation in
Android? or any way to use ImageMagick in Android?

Thanks!

-- 

3. Android in ARM926EJ CPU

4. start logcat service by change init.rc

5. Logging for system components

6. chmod by init.rc

7. ssh to htc development phones