Remotely control Android smartphone from Ubuntu 20.04 LTS without rooting
3 min read
- The Android device requires at least API 21 (Android 5.0).
- Make sure you enabled adb debugging on your device(s).
- On some devices, you also need to enable an additional option to control it using keyboard and mouse.
- adb be installed using sudo
$ apt install android-tools-adb.
This application provides display and control of Android devices connected on USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS.
It focuses on:
- lightness (native, displays only the device screen)
- performance (30~60fps)
- quality (1920×1080 or above)
- low latency (35~70ms)
- low startup time (~1 second to display the first image)
- non-intrusiveness (nothing is left installed on the device)
$ apt install scrcpy
A Snap package is available: scrcpy. Or you can search scrcpy in Ubuntu Software and install it.
This application provides two options to connect your smartphone.
You can choose 1 in 2 ways below.
Plug an Android device, and execute
It accepts command-line arguments, listed by:
$ scrcpy --help
Connected over TCP/IP
You must follow requirement on top of this guide to ensure everything will work well.
Step 1: Make sure you turn on Developer mode in your Samsung smartphone.
Step 2: Turn on USB debugging in Developer options.
Step 3: Connect your Android device and adb host computer to a common Wi-Fi network accessible to both. Beware that not all access points are suitable; you might need to use an access point whose firewall is configured properly to support adb.
Step 4: Connect the device to the host computer with a USB cable.
Step 5: Set the target device to listen for a TCP/IP connection on port 5555.
$ adb tcpip 5555 restarting in TCP mode port: 5555
If you got an error:
$ adb tcpip 5555 error: no devices/emulators found
Make sure you followed step 1 and 2 above. Or you can check the solution in Stackoverflow.
Step 6: Disconnect the USB cable from the target device.
Step 7: Find the IP address of the Samsung device. For example, on a device, you can find the IP address at Settings > About phone > Status > IP address.
Step 8: Connect to the device by its IP address.
$ adb connect device_ip_address:5555
Step 9: Confirm that your host computer is connected to the target device.
$ adb devices List of devices attached device_ip_address:5555 device
Step 10: Connect Samsung device
Now, you are good to go!
You can read more scrcpy here.