Reputation: 5689
I have done the coding on getting all the installed packages in the android system! now what I want is to get the pid of that package since I want the current resource usage of the package! I dont know the method of doing this, where I know the reverse of it! :) I dont want to use the shell either! is there a way to achieve this! or else I'll state what I want to do and suggest me a better way..
what I want :
I have created an activity, where I take all the current installed third party applications or the system. used the package manager to get it! I listed it on a layout and when I click on an application I want it to direct to another screen where all the details are shown about the application. I already have some details which i got using the package name of the application. the thing is, I want to show the memory info, and the code size of the application! how can I achieve this! :)
please help!
Upvotes: 1
Views: 5116
Reputation: 27549
PID is denoted to Process ID in Android. And as you are telling you need process ID of all installed applications, But afaik PID is given to application/service/process which are running, So you can not ask for process ID for all installed apps.
You can get pids of all running apps, by using below code..
RunningAppProcessInfo service[]= manager.getRunningAppProcesses();
String = service.pid;
Upvotes: 2