android 判断是否在debug模式

来源:互联网 发布:风险加权资产计算法 编辑:程序博客网 时间:2024/06/10 20:41

public static boolean isDebuggable() {    boolean debuggable = false;    PackageManager pm = getInstance().getPackageManager();    try{        ApplicationInfo appinfo = pm.getApplicationInfo(getInstance().getPackageName(), 0);        debuggable = (0 != (appinfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));    }catch(PackageManager.NameNotFoundException e){        /*debuggable variable will remain false*/    }    return debuggable;}