Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.31k stars 10.67k forks source link

Would there be any way of preparing scrcpy from Tasker with adb commands without having to plug into the PC? #1879

Open Pixxel123 opened 3 years ago

Pixxel123 commented 3 years ago

The Android app Tasker allows adb commands to be sent via the ADB Wifi action. Would there be a way to allow my phone to send adb commands so that scrcpy can be connected wirelessly without having to be plugged in at all if adb tcpip 5555 is already granted?

I have tried to find my phone's IP address with the Tasker Wifi Info variable: %WIFII. Splitting this, I've pulled out my phone's IP address.

This is the task:

ADB Test Scrcpy (389)
    A1: Variable Set [ Name:%address To:%WIFII Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 
    A2: Variable Search Replace [ Variable:%address Search:\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b Ignore Case:Off Multi-Line:Off One Match Only:On Store Matches In Array:%address Replace Matches:Off Replace With:/1 ] 
    A3: ADB Wifi [  Command:adb tcpip 5555; adb connect %address1:5555 Host: Port: Timeout (Seconds):1 Enable Debugging (Check Help):On ] 

Would I have to use my PC's IP address instead? Is this even possible? The end result that I'm after is something like:

  1. Run Task
  2. Just run scrcpy.exe
  3. Phone is connected to PC wirelessly.
rom1v commented 3 years ago

I don't really know Tasker, but as soon as you see your device in adb devices scrcpy should be ok.