Andy Burnelli wrote:
>> Are you querying the need for a QR code or pairing-code to be entered?
>
>> Then I set the Android "Wireless debugging" option on. <== this is new!
> Android 12 Developer options > Wireless debugging = On
I admit I had never seen this new QR code option Andy Burns asked about.
<
https://developer.android.com/studio/images/run/adb_wifi-wireless_debugging.png>
Nor have I ever needed to use a six-digit "pairing code" Andy Burns spoke
about. Up until now, the connection did all the work for me without either.
That's because for Android 10 and lower, the USB cable pairing was required
(even when connecting Android to the Windows PC over Wi-Fi).
<
https://developer.android.com/studio/command-line/adb#wireless>
To sharpen the saw (aka to learn more about any problem set you encounter),
I looked up what the _new_ option of "wireless debugging" does with adb.
*How To Connect Wireless Debugging From Developer Options*
<
https://youtu.be/ElahzmTPCYE>
From that video I realized you need to both turn on and long press the
Android ADB wireless-debugging option in order to even _see_ the QR-code
options Andy Burns was asking about, which is why I had never seen them.
While I've been using adb in a rudimentary fashion for years, this
"wireless debugging" option is apparently new with Android 11 and up.
*Android 11 DP2: Wireless debugging gives developers hassle-free ADB connection*
<
https://9to5google.com/2020/03/18/android-11-dp2-wireless-adb-debugging/>
"Simply put, Wireless debugging will let you leave your USB cable
behind and connect your phone to your computer via ADB completely
over Wi-Fi. Of course, considering how many potentially bad things
you can do to a phone once you have ADB access, it's not as simple
as just connect and go."
*Connect to a device over Wi-Fi (Android 11+)*
<
https://developer.android.com/studio/command-line/adb>
"Android 11 and higher supports deploying and debugging your app
wirelessly from your workstation using Android Debug Bridge (adb).
This eliminates the need to deal with common USB connection issues,
such as driver installation.
To use wireless debugging, you must pair your device to your
workstation using a QR Code or a pairing code. Your workstation
and device must be connected to the same wireless network."
Even more useful perhaps is you can elevate a non-root phone's privileges.
*Wireless Debugging with Termux*
<
https://youtu.be/KCODAyc_6rU>
1. On the Android phone, install Termux
2. In the Android Termux, type "pkg install android-tools"
3. On Android, turn on wireless debugging from the developer options menu
4. Then using only Android and no PC whatsoever, pair Android with itself!
% adb pair localhost:40737 <then add the 6-digit wi-fi pairing code>
5. On Android, use adb within Termux to connect wirelessly to itself.
% adb connect localhost:40737
6. At this point, you can drop into an adb shell inside of Android Termux.
% adb shell
# run-as com.termux
$
Apparently that gives you extra privileges even if you're not rooted.
What is interesing is the _power_ this provides, e.g., Frank Slootweg may
be interested that we can port forward over Wi-Fi (which means, perhaps,
just maybe we can finally connect on a non-rooted phone over SMB using
ports lower than 1024 on Android), and, for example, we can examine our
Android sqlite contacts database <
https://www.sqlite.org/cli.html>.
$ adb -s emulator-5554 shell
$ sqlite3 /data/data/
com.example.app/databases/rssitems.db
SQLite version 3.3.12
Enter ".help" for instructions
In summary, this ability to eliminate the USB cable completely is new as of
Android 11 and above. It allows us to more easily use adb over Wi-Fi, where
we can now perhaps elevate permissions temporarily (e.g., to delete
packages that are not delete able or to forward ports for SMB and to
examine the default protected contacts sqlite database on Android).
--
Usenet is where kind-hearted well educated people gather to exchange ideas.