Getting “debuggable” value of androidManifest from code?

后端 未结 2 1214
無奈伤痛
無奈伤痛 2020-11-28 04:02

I\'ve written a wrapper on top of Log.java that is provided by android. My Class will add some other application level features in Logs.

Now the things is that I wan

相关标签:
2条回答
  • 2020-11-28 04:12

    You can now use the static boolean field BuildConfig.DEBUG to achieve the same thing. This class is generated during compilation and can be seen in your gen folder.

    0 讨论(0)
  • 2020-11-28 04:30

    Use PackageManager to get an ApplicationInfo object on your application, and check the flags field for FLAG_DEBUGGABLE.

    boolean isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
    
    0 讨论(0)
提交回复
热议问题