-----
No need to use grep. ps
in Android can filter by COMM
value (last 15 characters of the package name in case of java app)
Let's say we want to check if com.android.phone
is running:
adb shell ps m.android.phone
USER PID PPID VSIZE RSS WCHAN PC NAME
radio 1389 277 515960 33964 ffffffff 4024c270 S com.android.phone
-----
for (RunningAppProcessInfo runningProInfo : runningProcInfo) {
int pid = runningProInfo.pid;
Log.e(TAG+"-pid", ""+pid);
}
-----
http://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html
RunningAppProcessInfo
importance | The relative importance level that the system places on this process. | |
importanceReasonCode | The reason for importance , if any. | |
importanceReasonComponent | For the specified values of importanceReasonCode , this is the name of the component that is being used in this process. | |
importanceReasonPid | For the specified values of importanceReasonCode , this is the process ID of the other process that is a client of this process. | |
lastTrimLevel | Last memory trim level reported to the process: corresponds to the values supplied toComponentCallbacks2.onTrimMemory(int) . | |
lru | An additional ordering within a particular importance category, providing finer-grained information about the relative utility of processes within a category. | |
pid | The pid of this process; 0 if none | |
pkgList | All packages that have been loaded into the process. | |
processName | The name of the process that this object is associated with | |
uid | The user id of this process. |
---------
Is process name same as package name in android?
1 | By default android takes the package name as the process name. But if you define process property in application tag in manifest file As for your questions,
Hope this answers your question! |
'JAVA > Android' 카테고리의 다른 글
다른 어플 실행 (0) | 2015.04.01 |
---|---|
어플 종료 (0) | 2015.04.01 |
안드로이드 뷰 동적으로 마진주기 (0) | 2015.03.15 |
브로드 캐스트 리시버 기본 사용예제. (0) | 2015.01.13 |
안드로이드 AIDL (0) | 2015.01.13 |