투케이2K

512. (Android/Java) [ActivityManager] : RunningAppProcessInfo 현재 실행 중인 앱 프로세스 패키지 명칭 확인 본문

Android

512. (Android/Java) [ActivityManager] : RunningAppProcessInfo 현재 실행 중인 앱 프로세스 패키지 명칭 확인

투케이2K 2023. 3. 3. 14:04

[개발 환경 설정]

개발 툴 : AndroidStudio

 

[소스 코드]

        // -------------------------------------
        // [로직 처리 실시]
        // -------------------------------------
        try {
            ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
            List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfoList = am.getRunningAppProcesses();
            List<String> processNameList = new ArrayList<String>();
            for (ActivityManager.RunningAppProcessInfo rapi : runningAppProcessInfoList) {
                processNameList.add(rapi.processName);
            }
            S_Log.ltd("================================================");
            S_Log.cnt("["+ACTIVITY_NAME+" >> "+C_Util.getNowMethod(1)+" :: processNameList]");
            S_Log.cnt("[data :: "+processNameList.toString()+"]");
            S_Log.lbd("================================================");
        }
        catch (Exception e){
            e.printStackTrace();
        }
 

[결과 출력]

 

D///===========//: ================================================
I/: [A_Intro >> onCreate :: processNameList]
I/: [data :: [com.example.javaproject]]
D///===========//: ================================================

 


 
반응형
Comments