Android examples for android.content.pm:PackageManager
get Running Pkg
import android.app.ActivityManager; import android.content.Context; public class Main { public static String getRunningPkg(Context con) { ActivityManager am = (ActivityManager) con .getSystemService(Context.ACTIVITY_SERVICE); return am.getRunningTasks(1).get(0).topActivity.getPackageName(); }// ww w. j a v a 2 s .c o m }