Adb connect via Appium java client

Is it possible to add devices to known devices list (execute adb connect) via Appium java client?

No, it is not possible to add devices to the known devices list directly via the Appium Java client. it focuses primarily on automating interaction with mobile devices for testing purposes, rather than managing the devices themselves. To add devices to the device list in promt:
adb connect <device_ip_address>
in <device_ip_address> replace the IP address of the device you want to connect to. This command establishes a connection between your machine and the device over the network

i am getting list of connected devices to our macMinis:

// Android
adb devices
// iOS
xcrun xctrace list devices

// I use simple Java command as far as code executing on same machine where phones connected
Runtime.getRuntime().exec(cmd).getInputStream();

After this I start tests with number of threads = devices I have.

You can also use https://appium.io/docs/en/2.0/guides/execute-methods/ to execute code on machine where Appium server runs and get output of terminal command.

1 Like

I think I need to something different. I need to add a device to the known list, i.e. before the autotests run, the device is not in it. At the same time, the autotest code and the appium server are on different hosts.

to get any info from remote machine you need at least connect to it first :slight_smile:

This is the question.

If all I have is the ip address of an Appium server, is there any way to add a device to the adb list that the server uses?

I think Aleksei explained it, appium will not control the adb service, you have to do that, it’s a layering approach, appium is just a tool, you need to move all the parts into place yourself. Moreover you can use runtime remoting to call exec() on that machine and tell adb (ont that machine) to make a connection to a phone. Networks are fun.