Android - How to check if developer option is enabled

How to check if a user has a developer option on his device? (not with an active adb connection or an active USB debugger, I need to know only if the developer option is enabled).

I tried this solution: How to check programmatically, does the application work in debug mode or not? but it does not work for me. thanks in advance

+4
source share
3 answers

try the following:

int adb = Settings.Secure.getInt(this.getContentResolver(),
                Settings.Global.DEVELOPMENT_SETTINGS_ENABLED , 0);
+5
source

You must use getInt or another in Settings.Global with   DEVELOPMENT_SETTINGS_ENABLED

: API 17, , Settings.Secure

+1

Here is a method that returns true if the developer mode is enabled for all devices on Android 4.1 or higher (API 16), returns false if the developer mode is not enabled on such devices and returns false on all previous Android devices up to 1.0.

        @android.annotation.TargetApi(17) public boolean isDevMode() {
            if(Integer.valueOf(android.os.Build.VERSION.SDK) == 16) {
                return android.provider.Settings.Secure.getInt(getApplicationContext().getContentResolver(),
                        android.provider.Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED , 0) != 0;
            } else if (Integer.valueOf(android.os.Build.VERSION.SDK) >= 17) {
                return android.provider.Settings.Secure.getInt(getApplicationContext().getContentResolver(),
                        android.provider.Settings.Global.DEVELOPMENT_SETTINGS_ENABLED , 0) != 0;
            } else return false;
        }
0
source

Source: https://habr.com/ru/post/1599248/


All Articles