Java tutorial
//package com.java2s; import android.app.ActivityManager; import android.content.Context; public class Main { public static String getCurrentProcessName(Context context) { String currentProcName = ""; int pid = android.os.Process.myPid(); ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); if (manager == null) { return ""; } for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { if (processInfo.pid == pid) { currentProcName = processInfo.processName; } } return currentProcName; } }