Connect a paired bluetooth device via terminal on Android - android

I need to connect a paired bluetooth devices via the terminal, when it does not connect automatically.
On my Android 7.1 device I would normally click the bluetooth device to connect it, in bluetooth settings. Unfortunately, I do not have a touchscreen or mouse in my setup. So I'd like to use the terminal to connect it. For specific reasons I do want to do this from the Android device, not from a connected PC etc.
I only found a way to enable and disable bluetooth via adb (adb shell service call bluetooth_manager 8). As mentioned I do not want to use adb, but I want to connect from my Android device. Is it also possible to connect to paired devices?

Related

Android 11/12 Wireless Debugging not available when using Mobile Hotspot as the network

Before android 11, i was able to wirelessly debug apps using this method
turn on the mobile hotspot in the (target) android phone
connect the computer to the hotspot
run adb tcpip 5555
adb connect [ip of the target phone]
The problem is
Android 11 introduced Wireless Debugging and the above method doesn't work as expected.
And the wireless debugging mode cannot be turned on unless my android phone is connected to wifi
so it is not working because I want to use the target phone's hotspot for wireless debugging.
is there any possible solution?
or
is it possible to turn the wireless debugging mode ON even if the phone is not connected to wifi?
Work Around
run adb tcpip 5555
run adb connect [ip]
go to Settings/Display & brightness/Auto screen off and make it 30 minutes. (means that your phone won't auto lock so it will stay wirelessly connected to ADB)
I hope android engineers will allow using the wireless debug feature without being connected to WiFi in newer versions of android though, as pointed to in the question.

Connect to paired device from PC

My android device is paired with the PC with adb pair. I can connect it over wifi with adb connect <IP:Port No>. I want to automate the connection process, but since the port number changes every time I restart or disconnect the device, I need to look it up from the device and enter the port number in the automation script.
Is there any way to get the port number of the paired device from adb (or any other tool) from the PC without connecting it?
[Note: This certainly seems possible since after starting the android studio the device gets connected over wifi automatically. So android studio does get the port number of the paired device automatically.]

Android ADB Wifi connection lost/reset

I'm using the Android wifi ADB plugin for Android Studio to connect my phone to my laptop for development purposes. The plug-in is great and does what it's supposed to.
However, I have to set up the ADB via USB every time I start Android Studio.
Clicking on the plug in icon states that there are no connected devices and to review my USB connection.
This also happens if I don't use the ADB for some time.
Is there any way to connect via wifi seamlessly?

Can't use adb when connected to VPN

My PC and Android TV device are in the same net section,so I can use adb connect the debugging device.Also ,I use adb devices command,it shows device on work.But when My PC and device use the same vpn based on the previous internet,I try to ping the device IP,it worked,then I use adb connect the device,it shows connect,but when input adb devices command , it shows device offline. I'm sure the error can't be caused by adb version,for it can work when disconnect the vpn.who can help me? I'm very appreciate for that.
If your PC and device are on the same LOCAL network, all you need to do is find the local IP address of the device (something like: 192.168.xx.xx). Then type:
adb disconnect
adb connect 192.168.xx.xx.
It'll connect again. Works for me.
The only time it does not work is when the device is the one providing the LOCAL network, e.g., your phone's mobile Hotspot. Using a VPN like this does not work directly. Whenever you use a VPN and try using ADB for a mobile hotspot (and the hotspot device is the one you're trying to connect to), you'll realize that the device goes offline.
This is because when you enter "adb connect <REMOTE_HOST>", your PC tries to route your device IP (REMOTE_HOST) via the VPN network, which will not be accessible since your ISP does not allow inbound connections to your device.
An alternative option, which I use for my device (Phone), is to use a wired connection to my PC via a USB cable. It might work for the Android TV if the proximity b/w TV and your laptop is not a problem.
Another alternative (supposing you're trying to connect a phone/Android TV) is to use another phone or router to create a hotspot. Then connect both your PC and phone/Android TV to the hotspot. Find the phone/Android TV IP address 192.168.xx.xx and enter:
adb connect 192.168.xx.xx.

ADB over bluetooth?

Is it possible to connect to ADB over bluetooth?
I am trying to test 3G data download, but want to have ability to connect to ADB without using USB. Using WiFi (local only) and 3G, as understand, will not work because Android will still use WiFi for downloads (even that WiFi is local only, no outside exit).
How can I set up connection to ADB over bluetooth to send ADB commands for Android device to execute?
I have seen people post that they have been able to do it just like with WiFi using Bluetooth tethering. You'll need to find your IP address.

Categories

Resources