美文网首页
Android应用判断是否是Debug模式

Android应用判断是否是Debug模式

作者: Brian512 | 来源:发表于2019-07-26 11:38 被阅读0次

判断是否为debug包:

    private static int sIsDebugMode = -1;
    public static boolean isDebugMode(Context context) {
        if (sIsDebugMode == -1) {
            boolean isDebug = context.getApplicationInfo() != null
                    && (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
            sIsDebugMode = isDebug ? 1 : 0;
        }
        return sIsDebugMode == 1;
    }

参考文章:https://www.cnblogs.com/zhujiabin/p/6874508.html

相关文章

网友评论

      本文标题:Android应用判断是否是Debug模式

      本文链接:https://www.haomeiwen.com/subject/rserrctx.html