Android examples for Android OS:Process
get Process Name From Activity Manager
//package com.java2s; import android.app.ActivityManager; import android.content.Context; public class Main { public static String getProcessNameFromActivityManager(Context ctx) { String processName = ""; int pid = android.os.Process.myPid(); ActivityManager manager = (ActivityManager) ctx .getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningAppProcessInfo processInfo : manager .getRunningAppProcesses()) { if (processInfo.pid == pid) { processName = processInfo.processName; break; }//from ww w . jav a2s . c o m } return processName; } }