AndroidViewClient icon indicating copy to clipboard operation
AndroidViewClient copied to clipboard

Is there any way to connect to remote phone?

Open JinzhuWu opened this issue 5 years ago • 2 comments

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?

JinzhuWu avatar May 18 '20 09:05 JinzhuWu

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')

dtmilano avatar May 19 '20 07:05 dtmilano

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 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')

JinzhuWu avatar May 20 '20 03:05 JinzhuWu