View, Hear, Control Your Android Device on Your Linux PC (Wireless, USB)

Prerequisites:

  • Laptop/PC with a Linux distribution OS w/ PulseAudio and Bluetooth
  • adb: Android Device Bridge (more info)
  • scrcpy: apt install scrcpy (more info)
  • USB Debugging enabled on your device

Steps:

  1. Connect your Android device with USB Debugging enabled under Developer Options (more info)
  2. To use over WiFi, make adb on the device work over TCP/IP by running: adb tcpip 5555 (more info). Android 11 makes this process easier with a simple toggle

    !! Note that this will create a giant security hole. Please ensure that you understand the risks. !!

    If you're an Android developer, using adb over WiFi will probably save your device's battery from going kaput long before it's natural lifespan.
  3. Ensure that the phone is unlocked, keep your screen awake longer using options in Settings > Display
  4. Run adb connect <DEVICE_IP_ADDRESS> and ensure that the device is listed under adb devices (or configure udev rules - more info)
  5. Run scrcpy in a terminal (more info). This should display a window with your device's screen, and you should be able to control it with your mouse and keyboard
  6. Configure PulseAudio on your laptop as a Bluetooth receiver/speaker:
How to Stream Audio from Your Phone to Your Laptop
This guide describes how to stream audio from your smartphone to your computer over Bluetooth.

7. Pair Bluetooth on your device with the PC
8. You can also use sndcpy as an alternative to Bluetooth audio, but it's more restrictive
9. You can control and use your phone remotely even with it's screen turned off (CTRL + O in scrcpy)

Result: