如何检查编程是否应用程序正在运行的调试模式或不? [英] How to check programmatically whether app is running in debug mode or not?

查看:174
本文介绍了如何检查编程是否应用程序正在运行的调试模式或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须确定一些发生在我的应用程序,在调试模式或实况模式我的应用程序是否正在运行。是否有任何功能或一张code可用来检查。开/关在这两种情况下,它返回真/假。如果是的话,请帮助我。先谢谢了。

I have to identify at some place in my app that, whether my app is running in debug mode or live mode. Is there any function or piece of code available to check that. that returns true/false in either case on/off. if so, please help me out. Thanks in advance.

推荐答案

这是@ Im0rtality提供的答案是正确的:

The answer that @Im0rtality provides is the correct one:

boolean isDebuggable =  ( 0 != ( getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) );

(从这个谷歌的博客文章

更新:可能是&安培; = 应该只是&安培; 的上述前pression,虽然&安培; = 是谷歌在其博客文章)

(UPDATE: probably the &= should be just & in the above expression, though &= is what Google has in their blog post)

感谢您的合作,但它不工作在我的情况

thanks for cooperation but it is not working in my case

我很遗憾听到这个消息。当然,由于解释什么是不工作在我的情况是你当选跳过,我不能帮助您进一步。

I'm sorry to hear that. Of course, since explaining what "not working in my case" is something you elected to skip, I cannot help you further.

这篇关于如何检查编程是否应用程序正在运行的调试模式或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆