Is it possible to list connected devices in a server? #505
-
I've got a use case where I need to let remote software developers access and control Android devices connected to a Ubuntu server. These devices are POS machines and we're not able to reproduce their environment in a simulator. We do need to have them connected through ADB so we can properly debug the app. Would it be possible to detect, list and connect devices and let everyone control them, using ya-webadb?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It depends on what you want the client to be able to do. If you expect the client to deploy and debug Apps from Android Studio, that's nearly impossible. If all features on the client side are developed by yourself, running in a Web browser (for example uploading an APK to install and control the device using Scrcpy Web client), although the code here can't do that, it's totally possible. Here are three methods you can connect to your devices over Internet.
The above two methods have one same issue: they must connect to devices directly, in another word, no native ADB is running. The ADB daemon on device can only accept one connection at a time (as discussed above), so native ADB has a server (running on the computer, started by the first client) that manages connections. Each ADB command you type in terminals spawns a ADB client. It connects to the server using TCP socket, and let the server forwards the real request to device. The protocol between client and server is slightly different from server to daemon, and is not supported by this library, so this library can't be used when native ADB is running. So the third method is to implement this protocol between client and server using Node.js Back to the beginning, if you want to let clients deploy and debug Apps from Android Studio, or use native Scrcpy client to mirror the screen and control the device, you need to forward the ADB server socket to client machine. The most commonly used method is SSH tunnel. With this method the ADB clients on client machines just works automatically. |
Beta Was this translation helpful? Give feedback.
It depends on what you want the client to be able to do. If you expect the client to deploy and debug Apps from Android Studio, that's nearly impossible. If all features on the client side are developed by yourself, running in a Web browser (for example uploading an APK to install and control the device using Scrcpy Web client), although the code here can't do that, it's totally possible. Here are three methods you can connect to your devices over Internet.
The simplest method is to forward all data from/to devices over a Web-friendly protocol, and let the core library runs at the client side to handle them. It's very easy to create custom transportation adapters for it. The adapter doe…