With Scrcpy you can use your phone from your computer. Or use it as a webcam really easily.
Installation
Install Scrcpy in Ubuntu 20.04
sudo apt-get install scrcpy
Be sure you have adb installed
sudo apt-get install adb
Usage
To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom. Plug your phone via usb. Then
scrcpy
All working 😉
Usage via Wifi
You can now use it via wifi. Really useful.
- 1- You need to be in the same wifi network, phone and computer.
- 2 – Plug your phone first via usb.
- 3 – Get your device IP address (in Settings → About phone → Status)
- 4-Â Execute
- adb tcpip 5555
- adb connect (your phone ip)
- 5. Unplug your device
- 6. Run scrcpy as usual
To switch back to USB mode: adb usb
.
Using scrpy as a “webcam”
This is a simple hack but for me super useful since the webcam of my laptop sucks big time. Install in your android Open Camera. Then open Open Camera and in Settings-> On Screen Preview -> Immersive mode hide everything. Ready!
Create a shortcut
To create a shortcut for the icon to appear in Ubuntu, create a file
gedit ~/.local/share/applications/scrcpy.desktop
Inside type
[Desktop Entry]
Name=scrcpy
Comment=scrcpy
Exec=scrcpy
Terminal=false
Type=Application
Categories=Image;
Then execute:
sudo update-desktop-database
and ready!