如何检查编程是否应用程序正在运行的调试模式或不?或不、应用程序、正在运行、模式

由网友(┏(^ω^)=?长腿欧巴)分享简介:我必须确定一些发生在我的应用程序,在调试模式或实况模式我的应用程序是否正在运行。是否有任何功能或一张code可用来检查。开/关在这两种情况下,它返回真/假。如果是的话,请帮助我。先谢谢了。I have to identify at some place in my app that, whether my app i...

我必须确定一些发生在我的应用程序,在调试模式或实况模式我的应用程序是否正在运行。是否有任何功能或一张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.

阅读全文

相关推荐

最新文章