您的位置:首页 > 其它

这是个用来确认当前是否是调试模式然后判断是否需要打印日志的很好的方法,具体链接不知道,但是很感谢作者

2016-05-04 10:12 519 查看
/**
* 但是当我们没在AndroidManifest.xml中设置其debug属性时:
* 使用Eclipse运行这种方式打包时其debug属性为true,使用Eclipse导出这种方式打包时其debug属性为法false.
* 在使用ant打包时,其值就取决于ant的打包参数是release还是debug.
* 因此在AndroidMainifest.xml中最好不设置android:debuggable属性置,而是由打包方式来决定其值.
*
* @param context
* @return
*/
private boolean isApkDebugable(Context context) {
try {
ApplicationInfo info= context.getApplicationInfo();
return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: