[Android Pro] Get the app that the phone has installed and get all the processes that are currently running (one UID corresponds to multiple PID)

Source: Internet
Author: User

1: Get Packagemanager Get all statically installed apps:

?
1 PackageManager pm = getPackageManager(); <br>List<PackageInfo> infos = pm.getInstalledPackages(0); <br><br>icon  : info.applicationInfo.loadIcon(pm)<br>appName : info.applicationInfo.loadLabel(pm)

2: Get Activitymanager Get dynamic all running processes

?
12 ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);List<RunningAppProcessInfo> infos = am.getRunningAppProcesses();<br><br>info.processName + " ; "+ info.uid + " ; "+ info.pid
?
1 类似如下输出:

10-20 13:43:16.047:i/system.out (28009): Com.qihoo360.mobilesafe:FloatWindow; 10057; 27991

10-20 13:43:16.047:i/system.out (28009): Com.qihoo360.mobilesafe:GuardService; 10057; 25390

10-20 13:43:16.047:i/system.out (28009): com.qihoo360.mobilesafe:clear; 10057; 27532

[Android Pro] Get the app that the phone has installed and get all the processes that are currently running (one UID corresponds to multiple PID)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.