Skip to content

Instantly share code, notes, and snippets.

@datvm
Last active August 31, 2026 04:04
Show Gist options
  • Select an option

  • Save datvm/10edd5ad70f35f946dfd075f48940fc8 to your computer and use it in GitHub Desktop.

Select an option

Save datvm/10edd5ad70f35f946dfd075f48940fc8 to your computer and use it in GitHub Desktop.
Commands for connecting to Android phone over Wifi (Wireless Debugging) with ADB

Setup the Phone

To enable developer options, tap the Build Number option 7 times. You can find this option in one of the following locations, depending on your Android version:

Android 9 (API level 28) and higher: Settings > About Phone > Build Number

  • Enable Wireless Debugging: Settings > search Wireless Debugging.

image

  • Pick Pair device with pairing code option.

Pair and Connect with ADB

  • Run adb pair <ip>:<port> <pairing code> (showed in the Pair with device dialog shown after picking above option). For example:
adb pair 192.168.1.123:41000 123456
  • Run adb connect <ip>:<port>.

Note:
The port for pairing and connecting may be different. The port for connecting is listed at IP address & Port in Wireless Debugging panel (see above screenshot, first red square)

adb connect 192.168.1.123:41001

Confirm that it works by running adb devices:

List of devices attached
192.168.1.123:41001       device
adb-random-text._adb-tls-connect._tcp.        device
@uimik

uimik commented Jul 13, 2026 •

Copy link
Copy Markdown

The following code will trigger the specific system intent from your app:

import android.content.Context
import android.content.Intent
import android.provider.Settings
import android.widget.Toast

fun openWirelessDebuggingSettings(context: Context) {
// Intent for direct Wireless Debugging Screen (Android 11+)
val wirelessDebugIntent = Intent("android.settings.WIRELESS_DEBUGGING_SETTINGS")

// Fallback Intent for main Developer Options Screen
val devOptionsIntent = Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS)

try {
    // Try opening the wireless debugging settings directly
    context.startActivity(wirelessDebugIntent)
} catch (e: Exception) {
    try {
        // Fallback to general developer options if direct link fails
        context.startActivity(devOptionsIntent)
        Toast.makeText(context, "Scroll down to find Wireless Debugging", Toast.LENGTH_LONG).show()
    } catch (ex: Exception) {
        // Developer options are likely fully disabled on the device
        Toast.makeText(context, "Developer Options are not enabled on this device.", Toast.LENGTH_LONG).show()
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment