Is there any way to connect to remote phone?
I find that ViewClient can connect to multi phones by distinguishing different serialno on local PC, is there any way to connect to a phone in a remote PC(share USB serial) or connect by network?
device, serialno = ViewClient.connectToDeviceOrExit(serialno)
If it works, could you give me a demo?
Sure there is. You can find more information about adb over the network at https://developer.android.com/studio/command-line/adb.
Then you can connect using something like this in your command line
$ adb connect 192.168.1.100:555
and in you python script
device, serialno = ViewClient.connectToDeviceOrExit(serialno='192.168.0.1:5555')
Thank you for your answer, this is a good way to complete some actions through the IP address of mobile network, and it can meet some of my requirements, but in one of my scenarios I need to modify the airplane mode, this action will cause the loss of ip address. Is there any way to meet the needs of this scene, such as sharing USB? Looking forward to your reply!
Sure there is. You can find more information about
adbover the network at https://developer.android.com/studio/command-line/adb.Then you can connect using something like this in your command line
$ adb connect 192.168.1.100:555and in you python script
device, serialno = ViewClient.connectToDeviceOrExit(serialno='192.168.0.1:5555')