Android Activity Package Get getRuningPkg(Context con)

Here you can find the source of getRuningPkg(Context con)

Description

get Runing Pkg

Declaration

public static String getRuningPkg(Context con) 

Method Source Code

//package com.java2s;

import android.app.ActivityManager;
import android.content.Context;

public class Main {
    public static String getRuningPkg(Context con) {
        ActivityManager am = (ActivityManager) con
                .getSystemService(Context.ACTIVITY_SERVICE);

        return am.getRunningTasks(1).get(0).topActivity.getPackageName();
    }/*from ww  w.j a  v a  2  s .c o  m*/
}