dadb icon indicating copy to clipboard operation
dadb copied to clipboard

Add support for `adb pair` (connecting with Android 11+ over Wi-Fi)

Open sharpordie opened this issue 2 years ago • 12 comments

Is the pair command supported by Dadb? If not, it would be great to add this feature.

https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+

sharpordie avatar Jul 29 '22 12:07 sharpordie

Hi @sharpordie - I'd like to understand your use case a bit better.

Today the following is supported:

  1. Pair your device over wifi using the standard adb pair HOST:PORT CODE command. eg: adb pair 10.0.0.192:5555 123456
  2. Once your device is paired, you can connect to your device using your device's IP address (same as HOST above): Dadb.discover(10.0.0.192) or Dadb.connect(10.0.0.192, 5555).

These steps requires the adb binary to initially set up the pairing, but since this is a one-time setup per laptop maybe that acceptable.

Do these steps satisfy your use case or are you looking for something else?

Leland-Takamine avatar Aug 22 '22 22:08 Leland-Takamine

Btw I just added documentation on this in the README: https://github.com/mobile-dev-inc/dadb/blob/master/README.md#connecting-to-a-physical-device

But I'm still interested in whether this solves your use case or if there's a reason you'd need / prefer built-in wifi pairing support in dadb?

Leland-Takamine avatar Aug 22 '22 22:08 Leland-Takamine

@sharpordie Please don't hesitate to reopen this issue if the above documentation doesn't work for your usecase!

Leland-Takamine avatar Aug 24 '22 18:08 Leland-Takamine

Dadb is presented as a library to connect to android device without an adb binary or server. So for me using adb binary to pair (or connect) a device first is a nonsense.

But it requires to find out how the official adb forges the "request" for pairing process for a proper dadb implementation.

sharpordie avatar Aug 26 '22 23:08 sharpordie

Here is a adb pair implementation: https://github.com/RikkaApps/Shizuku/blob/master/manager/src/main/jni/adb_pairing.cpp

tiann avatar Aug 31 '22 06:08 tiann

And here is a pure java implementation: https://github.com/MuntashirAkon/libadb-android/blob/master/libadb/src/main/java/io/github/muntashirakon/adb/PairingAuthCtx.java

tiann avatar Aug 31 '22 06:08 tiann

@tiann This is exactly what I would like in Dadb (with Kotlin).

sharpordie avatar Aug 31 '22 23:08 sharpordie

Not sure on timeline yet but opening this back up as it does seem like a use case folks are asking for.

Leland-Takamine avatar Aug 31 '22 23:08 Leland-Takamine

This would certainly be a game changer. I'd be willing to put forward some work into this as best I can. This library opens up so many possibilities.

tytydraco avatar Sep 30 '22 16:09 tytydraco

Hi dadb team, You guys made a great library. I would like to ask that any progress on this issue. Because i'm also want to pair using dadb and don't want use adb binary either

JamshedAlamQaderi avatar Feb 28 '23 13:02 JamshedAlamQaderi

Yes, I'd like to add my voice to the other requests to add a pairing option to dadb. We really need it for devices running Android 11+. Thank you.

malbry avatar Mar 24 '23 14:03 malbry

We really need adb pair

binglingziyu avatar Dec 15 '23 07:12 binglingziyu