[TUT] ADB over WI-FI - Micromax A116

ADB over Wi-Fi​Some of us might like to connect the device over WiFi for debugging, instead of using the data cable. Here's the required tutorial to do so
Requirements
1. Android device (duh!!!)
2. ADB in the computer (again duh!!!)
3. Root privileges
4. Terminal emulator (download from here)​
Let's begin then​Open terminal emulator on your device. Enter the following code
Code:
su [color="red"]Grant superuser here[/color]
setprop service.adb.tcp.port 5555 [color="red"]Can be anything else[/color]
stop adbd
start adbd
Check it with this
Code:
getprop service.adb.tcp.port
It will return 5555 or the number you entered in the above code​
Enter the following code on your computer in command prompt or shell
Code:
adb connect 192.168.0.151
Instead of 192.168.0.151, enter your device IP address​
To make your device listen on USB again, just restart the device. And enter the code on your computer
Code:
adb usb
I would definitely use the USB cable to push large files or even small files that you really don't want to risk corrupting (partition images you plan on dding, etc).
Very importantly, keep in mind, when your phone is listening for adb via WiFi, it's wide open... anybody that has adb installed and knows your device's IP address can access it without a password. Again, a simple reboot will turn it off though.​
Credits
JeepFreak for this post in the One X forum​

Reserved
Reserved for app​

I want to thank the OP, however belatedly, for writing these root instructions for users to connect their PC and phone via adb over Wi-Fi without USB cables being involved.
As the OP is well aware, non-rooted Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb start-server && adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to get, after the fact, the random port assignment that Android uses for the adb wireless connection to your PC.
Some related threads for reference might be...
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
(PSA) Using the new Android 12 TILE for 'Developer options' 'Wireless debugging' to establish adb connection over Wi-Fi without USB
What's the difference between Windows/Android adb "connect" versus adb "pair" when mirroring Android 12 over Wi-Fi onto a Windows PC?
The only question that's missing an answer preventing a perfect completely Wi-Fi automatic solution is...
Does anyone know how to obtain that random Android port address from the PC?

Related

[REQUEST] Wireless ADB

The Barnes & Noble Nook uses adb over wifi. How can I setup my N1 to do the same? Ideally I would like to specify on the N1 to only allow connections over wifi, and if possible have some sort of password type security. Can this be done?
why not use ssh?
the dropbear-client is included in most custom roms.
edit: i mean dropbear-server of course
mikecyber said:
The Barnes & Noble Nook uses adb over wifi. How can I setup my N1 to do the same? Ideally I would like to specify on the N1 to only allow connections over wifi, and if possible have some sort of password type security. Can this be done?
Click to expand...
Click to collapse
+1 on this, but I would like it to be included within the ROM with a UI setting or maybe even an applicaion
Getting adbd to listen to tcpip in the phone is quite easy.
Example below:
Code:
[I]# detach adbd from usb and tell it to listen to port tcp 2222
[/I][email protected]$ adb tcpip 2222
restarting in TCP mode port: 2222
[I]# tell your local adb command to use ip:port to connect through instead of usb (192.168.0.151 is my N1 on Wifi)
[/I][email protected]$ adb connect 192.168.0.151:2222
connected to 192.168.0.151:2222
[I]# connect over ip
[/I][email protected]$ adb shell
# uname -a
Linux localhost 2.6.29.6-cyanogenmod #3 PREEMPT Wed Jan 27 07:21:12 EST 2010 armv7l GNU/Linux
# exit
[I]# tell adbd to go back to listen on usb
[/I][email protected]$ adb usb
restarting in USB mode
packetlss said:
Getting adbd to listen to tcpip in the phone is quite easy.
Click to expand...
Click to collapse
Thank you, your method works well.
With my nook all I need to do is "adb connect 192.168.1.x:5555" I don't have to put adb into tcpip mode or enter "uname -a" in shell.
I would love to see "Wireless Debugging" in Settings -> Applications -> Development, or really anywhere in Settings. I haven't voided my N1's warranty, so an app to add this functionality would be great.
mikecyber said:
Thank you, your method works well.
With my nook all I need to do is "adb connect 192.168.1.x:5555" I don't have to put adb into tcpip mode or enter "uname -a" in shell.
I would love to see "Wireless Debugging" in Settings -> Applications -> Development, or really anywhere in Settings. I haven't voided my N1's warranty, so an app to add this functionality would be great.
Click to expand...
Click to collapse
That's because the nook adbd is configured to listen to tcp by default, on most other platforms it just listens to USB by default.
The 'uname -a' was just to show that I actually was connected to the phone. Nothing to do with the actual adb stuff at all, I was just lazy and copied from my terminal
MoDaCo Custom ROMs generally run dropbear by default with a password that is randomly generated on first startup.
I don't mind making an addon update zip for Cyanogen's ROM with this functionality if you want it?
P
bump
Found this really useful as my USB driver causes BSODs. thanks packetlss
1. connect device via usb
2. adb tcpip 2222
3. connect over wifi. adb connect 192.168.3.5:2222
4. adb commands as normal
can the OP remove [request] as this is now a [tip] or [howto]
britoso said:
bump
Found this really useful as my USB driver causes BSODs. thanks packetlss
1. connect device via usb
2. adb tcpip 2222
3. connect over wifi. adb connect 192.168.3.5:2222
4. adb commands as normal
can the OP remove [request] as this is now a [tip] or [howto]
Click to expand...
Click to collapse
Does the USB have to be hooked up each time, or is it a 1 time then WIFI is good after that?
Nice howto!!
britoso said:
bump
Found this really useful as my USB driver causes BSODs. thanks packetlss
1. connect device via usb
2. adb tcpip 2222
3. connect over wifi. adb connect 192.168.3.5:2222
4. adb commands as normal
can the OP remove [request] as this is now a [tip] or [howto]
Click to expand...
Click to collapse
Gotta say that is slick as sh**!!! How to get it to stay on tcpip via terminal on phone??
britoso said:
bump
Found this really useful as my USB driver causes BSODs. thanks packetlss
1. connect device via usb
2. adb tcpip 2222
3. connect over wifi. adb connect 192.168.3.5:2222
4. adb commands as normal
can the OP remove [request] as this is now a [tip] or [howto]
Click to expand...
Click to collapse
interesseting... thanks!
i'll try that
EDIT: worked so good - thx!
tbirdguy said:
Does the USB have to be hooked up each time, or is it a 1 time then WIFI is good after that?
Click to expand...
Click to collapse
Do it once and it stays...perhaps till you reboot the phone.
If your IP address on wifi you will need to run the connect command again. Also set the wifi-sleep mode to 'never', possibly install the wifi-keepalive app.
Its awesome to be able to run stuff on your phone straight from eclipse, unplugged; or install/push/pull files
xkonni said:
why not use ssh?
the dropbear-client is included in most custom roms.
edit: i mean dropbear-server of course
Click to expand...
Click to collapse
Do you know what the default pw is for dropbear? when i try to ssh with my local ip and root, i get a connection refused on port 22. i'm using cm6, do i have to enable it somehow?
TCPIP mode without connecting usb
Is it possible to enable ADBD tcpip mode without connecting device to USB port and use adb command? I mean maybe a command we can run in a Terminal Emulator?
bohlool said:
Is it possible to enable ADBD tcpip mode without connecting device to USB port and use adb command? I mean maybe a command we can run in a Terminal Emulator?
Click to expand...
Click to collapse
re,it's there any possible that get adb work over TCP/IP ,on all android devices(include non-rooted devices)?
wobiu said:
re,it's there any possible that get adb work over TCP/IP ,on all android devices(include non-rooted devices)?
Click to expand...
Click to collapse
I know how to enable it, just connect it with usb to computer and enter "adb connect tcpip <port>" then disconnect usb and connect phone to wifi, find the ip of phone and on your computer type "adb connect <ip>:<port>"
my problem is how can I do the first step without usb cable, i.e. using a terminal emulator. I have root access.
bohlool said:
my problem is how can I do the first step without usb cable, i.e. using a terminal emulator. I have root access.
Click to expand...
Click to collapse
would love to see this as well, can anyone with expertise in the area let us know if this is at all possible?
# adbd
As root on the device returns
Cannot bind tcp 5037
Im not home so i cant test but maybe this could work over tcp port 5037...
Sent from my Nexus One
bohlool said:
I know how to enable it, just connect it with usb to computer and enter "adb connect tcpip <port>" then disconnect usb and connect phone to wifi, find the ip of phone and on your computer type "adb connect <ip>:<port>"
my problem is how can I do the first step without usb cable, i.e. using a terminal emulator. I have root access.
Click to expand...
Click to collapse
for rooted device。you can use"start adbd" command to start adb daemon ,instead of plug into usb.
What am i looking for is a way to use adb over wifi for all device including non-rooted.
wobiu said:
for rooted device。you can use"start adbd" command to start adb daemon ,instead of plug into usb.
What am i looking for is a way to use adb over wifi for all device including non-rooted.
Click to expand...
Click to collapse
What is the port number then? is it 5037? Can I set it somewhere? (for rooted devices of course)

How to debugging Android Device with WIFI connection

You wanna debug your Android device, but have not usb cable on hand.
Don't worry, you can still connect your device through WIFI if your PC and Android device are on the same LAN.
Following the steps:
1. Ensure the debuging port of Android Devices. You may use command "adb shell setprop service.adb.tcp.port 5553" to set the port to be 5553. The default port is 5555.
2. Find out the IP address of Android Device. For examble, 192.168.1.107
3. On your PC, use the command "adb connect 192.168.1.107:5553"
4. After connected, you may see the devices' list by using command "adb devices"

[Q] ADB only over wIFI no USB

Hello!
I am trying to find a way that I can only communicate over wifi with the adb on my device. So that for example if someone plugs in an USB cable to his pc, he should not be able to see my device as adb device. The only way to do something with adb should be over wify.
Is there any way to do that, or is the usb adb always on if adb is activated ?
For anyone finding this thread in the future (like I just did looking for solutions), as of about Android 11 and up, adb works over wi-fi (without USB) on non-rooted Android phones via Developer options Wireless debugging switches.

Connect Android phone over Wi-Fi using ADB

(Many will consider this question a duplicate of similar questions but I don't think this question should be marked as duplicate because the answer requested here is different than others.)
I am searching for the solutions since many years and read a lot of pages on internet and StackOverflow but hasn't found any solution.
Once an non-rooted Android phone is authorized over USB using ADB then how to connect it over Wi-Fi every time without ever connecting the phone over USB?
I know that executing
Code:
adb start-server
then
Code:
adb tcpip 5555
and then
Code:
adb connect <IP.address.of.phone>
will connect the phone over Wi-Fi IF it is connected using USB when issuing these commands.
According to the answers/forums, there are 2 ways to connect Android phone over Wi-Fi:
The user has to first connect to USB even though the device is already authorized.
The phone needs to be rooted.
But I think, what I want to achieve, as per the question, must be possible because if ADB can connect over USB and then Wi-Fi, then there must be some way to accomplish with directly connecting over Wi-Fi if computer is already authenticated. The missing thing is to know what exactly ADB is doing when switching from USB to Wi-Fi. I think, it could be getting authorization again. But what if we store the authorization information (finger print? or encryption key?) once and use it every time to connect over Wi-Fi? (Please note that when first time authenticating the computer over USB, its finger print is showed in the Android phone, and it never asks again until the authorization is revoked/invalidated somehow. So, I think the requirement here is to revalidate the computer.)
I viewed the ADB repository and read the text files mentioning how ADB works. In one txt file I read that
Code:
adbd
(ADB Daemon) is started on port 5555 on the Android phone/emulator when
Code:
adb connect ___
command is executed. Is there anyway to manually start the daemon through a terminal app on the installed on phone? I tried 'adb', 'adbd' and 'setprop' commands in the Termux app but these commands doesn't exist. According to the txt files of the repository, the ADB on computer is sending the commands to the Android device/emulator and can start 'adbd' or set/open the port 5555 using
Code:
setprop service.adb.tcp.port 5555
command. Is there a way to do this on Android phone using a terminal app on a non-rooter phone?
Somebody who has knowledge of networking, Android and C/C++ language may be able to answer. One can look in the GitHub repo of ADB source code if they want to know what is happening during the connection process.
I'm a little late to answer your question at the time you asked it, but if it still helps the OP, non-rooted Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb start-server && adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to get, after the fact, the random port assignment that Android uses for the adb wireless connection to your PC.
Here are some related posts about that subject which may help the OP.
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
(PSA) Using the new Android 12 TILE for 'Developer options' 'Wireless debugging' to establish adb connection over Wi-Fi without USB
What's the difference between Windows/Android adb "connect" versus adb "pair" when mirroring Android 12 over Wi-Fi onto a Windows PC?
The only question that's missing an answer preventing a perfect solution is...
Does anyone know how to obtain that random Android port address from the PC?

is it possible to enable WPS to connect to a WiFi using ADB commands?

Is there any way to enable WPS in Android through ADB commands to get to connect to the WiFi?
What I want to do is automatically testing this feature in a router with different types of devices connected, one of them being a phone (any) with the latest version of Android (10.0 at the moment I'm writing this).
I'd like to control it through ADB for two reasons:
I want to automate it
I need to make sure the phone was disconnected and connected again thanks to WPS and not other settings of the phone itself or the router
Maybe I can control the app Simple WPS through ADB commands? However I'm a bit newbie using ADB and I'm not sure how to do that.
I also found the Wi-Fi Easy Connect, but again, not sure how to use it.
Thanks!
You can bring up Android Activities using adb.
For example:
adb shell "am start -a android.settings.WIFI_SETTINGS"
Then you can tap the buttons from adb, I think.
Here's an example using a different Activity.
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
That should pop up an Android "Reset Advertising ID" settings page.
C:\> adb shell input tap 500 400
If run after the command above, that will tap the button to
asking to "Opt out of Ads Personalization" in that Activity
if that button is like mine, at the X=500 & Y=400 location.
On my phone, this is the "Reset advertising ID" button location:
adb shell input tap 500 200
On my phone, this is the "OK" button on that GUI above.
adb shell input tap 700 1000
C:\> adb shell am force-stop com.google.android.gms
If run after bringing up the advertising-id reset Activity,
it will close the activity without doing anything else.
If you have already set up ADB on your Android and PC, then you can skip this step. If you haven’t, there is a first time for everything!
To use ADB on your system, you first need to download and unzip the Android SDK Platform Tools from the Android developer website.
Mac users can use Homebrew to install ADB using the command: brew install homebrew/cask/android-platform-tools
On your Android device, you will need to enable USB debugging in the developer settings before you can connect the device over ADB.
Go to Settings > About phone then tap on the Build number several times. Once again, go to Settings > Developer options, then toggle on USB debugging.
Once that’s done, connect the Android device to your PC using a USB cable. Make sure to always allow the USB debugging prompt that will appear on your Android device.
Regards,
J Wick

Categories

Resources