如何获取Android正在运行的应用和它的pid
2个回答
展开全部
ActivityManager mActivityManager = (ActivityManager)
this
.getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo>
mRunningProcess = mActivityManager
.getRunningAppProcesses();
int i =
1;
for (ActivityManager.RunningAppProcessInfo amProcess :
mRunningProcess)
{
Log.i("Application", (i++) + "PID: " +
amProcess.pid
+ "(processName=" + amProcess.processName +
"UID="+amProcess.uid+")");
}
this
.getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo>
mRunningProcess = mActivityManager
.getRunningAppProcesses();
int i =
1;
for (ActivityManager.RunningAppProcessInfo amProcess :
mRunningProcess)
{
Log.i("Application", (i++) + "PID: " +
amProcess.pid
+ "(processName=" + amProcess.processName +
"UID="+amProcess.uid+")");
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
mRunningProcess)
{
Log;.uid+".pid
+ "ActivityManager; +
amProcess.processName +
"PID;UID="Application"ActivityManager mActivityManager = (ActivityManager)
this
.RunningAppProcessInfo amProcess , (i++) + "
int i =
1;(processName=");
List<.getRunningAppProcesses();
mRunningProcess = mActivityManager
;)" + amProcess;+amProcess.i(": "
for (ActivityManager.RunningAppProcessInfo>.getSystemService(ACTIVITY_SERVICE)
{
Log;.uid+".pid
+ "ActivityManager; +
amProcess.processName +
"PID;UID="Application"ActivityManager mActivityManager = (ActivityManager)
this
.RunningAppProcessInfo amProcess , (i++) + "
int i =
1;(processName=");
List<.getRunningAppProcesses();
mRunningProcess = mActivityManager
;)" + amProcess;+amProcess.i(": "
for (ActivityManager.RunningAppProcessInfo>.getSystemService(ACTIVITY_SERVICE)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询