Displaying the Android screen on a computer is usually done for application demos, I need it to make a tutorial.
0.Configuration on Android
First activate the Developer Options feature on an Android phone. To activate it, go to Settings -> About phone -> Android version. Tap Android version 7 times.
Then come back and go back to Settings, already active Developer optons menu. I am using Redmi Note 8 with Android 9 (MIUI 11), the menu Developer options is located at Settings -> Additional settings.
Under Developer options, enable USB debugging.
Install adb and fastboot on Ubuntu 20.04.
sudo apt install android-tools-adb android-tools-fastboot
To display the Android screen on Ubuntu uses a utility application called scrcpy developed by Genymobile, the same company that developed Genymotion Android emulator.
sudo apt install scrcpy
3.Connect Android to Ubuntu
The next step is to connect your Android phone to Ubuntu using a USB cable.
After that run scrcpy through the terminal.
If successful, the scrcpy application window will open and display the Android screen.
5.Connection via Wireless Network
Displaying the Android screen on Ubuntu can also be connected via a wireless network connection. Connect the USB cable first, then run the command adb.
Enable tcpip on Android phone and open port 5555.
adb tcpip 5555
After that unplug the USB cable, then run adb again to connect via the IP address of the Android phone.
adb connect IP_ADDRESS_ANDROID:5555
After that, run scrcpy again. The Android phone screen has appeared on Ubuntu via a wireless network.
6.Multiple Android Screens
scrcpy can display multiple Android phone screens at once.
Show all connected Android devices.
Example of the results of the above command.
List of devices attached
Then run scrcpy followed by the serial number of the device.
Displays the screen of the Android phone connected with a USB cable.
scrcpy -s DEQKN9TNJ
Displays the screen of an Android phone connected to a wireless network.
scrcpy -s 192.168.1.8:5555
scrcpy supports a feature to record the screen and save it in mp4 or mkv format.
scrcpy -r record.mp4
Good luck 🙂