Anuj Zunjarrao
Anuj Zunjarrao

Reputation: 426

How to programmatically check WiFi adb Debugging is enable in android?

Settings.Global.ADB_ENABLED flag is only responsive for USB debugging. Is there an alternative for checking WiFi debugging in Developer options is enabled programmatically?

Upvotes: 0

Views: 586

Answers (1)

Muntashir Akon
Muntashir Akon

Reputation: 9441

There's Settings.Global.ADB_WIFI_ENABLED, but it's hidden from the user applications. But it can still be used anyway:

ContentResolver resolver = context.getContentResolver();
if (Settings.Global.getInt(resolver, "adb_wifi_enabled", 0) == 0) {
    // Wireless debugging enabled (since Android 11)
}

The constant could be hidden deliberately for many reasons including the possibility of future removal or alteration. Use it on your own risks.

Upvotes: 0

Related Questions