public class MyApplication extends Application{

    @Override
    public void onCreate() {
        int pid = android.os.Process.myPid();
        String processName = "";
        ActivityManager manager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningAppProcessInfo process: manager.getRunningAppProcesses()) {
            if(process.pid == pid)
            {
                processName = process.processName;
            }
        }
        
        Trace.d("application start,processName:"+processName);
        super.onCreate();
    }
}

 

posted on 2016-05-19 14:19  Android9527  阅读(8416)  评论(0编辑  收藏  举报