树莓派android系统,vnc远程访问

A VNC Server for Android allows remotely accessing the device’s screen. In this post, I will show you how to run a VNC server on Android and access its screen remotely.

Let us clear one thing up front. We are not going to be discussing VNC clients for Android. We are going to be looking at the other side of Virtual Network Computing (VNC), which is running an actual VNC server on Android device.

Information on how to remotely access Android device’s homescreen or interface is sparse. Most of the information out there seem to look at the reverse scenario - accessing a remote server on Android device using VNC Client app. Read: Setup VNC Server on Ubuntu: Complete Ubuntu Remote Desktop Guide
Setting up a VNC server for Android just as simple. In this post, I will show you how to setup an Android VNC server without root.

WHAT IS A VNC SERVER?

VNC stands for Virtual Network Computing. It is a way of sharing the graphical desktop of a system to a remote system. In addition to the graphical interface, input events (keyboard, mouse, etc.), audio, and clipboard can also be shared with the remote system.

Xubuntu Desktop From Remote Server On Tightvnc Viewer In Windows

This is a super cool way to access remote systems and works as if you are actually in front of the remote workstation. With my recent move to Proxmox, VNC setup on Ubuntu Server has as been very handy for me. [Read: Ultimate Docker Home Server with Traefik 2, LE, and OAuth / Authelia [2020]]

In this post, we are going to try to access my Android phone’s interface via VNC from a Windows laptop.

What can you do with VNC Server on Android?

Well, this is the million dollar question isn’t it?

In my case, I have Android tablets showing Home Assistant dashboards for home automation. [Read: My Smart Home setup – All gadgets and apps I use in my automated home]

Sometimes I want to check what is showing on the dashboard, which having to be in front of it.

SmartHomeBeginner brings in-depth tutorials easy enough to understand even for beginners. This takes considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:

  • Feeling generous? Buy me a coffee (or two).
  • May be another day? Shop on Amazon using our links. Your prices won’t change but we get a small commission.
  • Don’t feel like spending? You can still show your support by sharing this post, linking to it in forums, or even commenting below.
    That is just one application. If you have other applications you can think, please share with the rest of the us in the comments section.

VNC SERVER FOR ANDROID WITHOUT ROOT

While there are numerous VNC clients for Android, there aren’t many VNC Server Android apps. In fact, when I did my research I could only find one that worked well: droidVNC-NG.

Droidvnc-Ng App - Vnc Server For Android

The best part is, droidVNC-NG app is free. Go ahead, head to the Play store and install droidVNC-NG and let us get started with setting up an Android VNC server. Alternatively, if you have droidVNC-NG VNC server Android apk, install it and proceed.

Is VNC Server free?
It depends on the server app. Some are paid. But there are free ones too (eg. droidVNC-NG for Android). Once a VNC Server is running, there are several free client apps to access the server.

  1. VNC Server Port and Password
    When you open the app, you should see an Android VNC server interface that looks like what is shown in the image below.
    Droidvnc App - Set The Port And Vnc Password

First, provide a port number for VNC server. Typically it is 5900. But you could change it to whatever (typically 59xx). In this Android VNC server guide, I am going to use 5902.

Next, provide a password for the VNC connection. Pick a strong password. In this tutorial, I am picking test (NOT a strong password).

We are not going to be discussing advanced configurations such as VNC through SSH tunnel, which provides an encrypted connection. Therefore, setting up a strong password is a bare minimum for security.

  1. Accessibility Permissions for Android VNC Server
    Next, we need to enable Accessibility permissions for the Android VNC server. This allows remote control of the Android device. So click on Screen Capturing and grant accessibility permissions to droidVNC-NG app, as shown below.

    Enable Android Accessibility Permissions
  2. Grant View and Control Permissions
    We also need to grant view and control permissions to the VNC server for Android. Click on Input to grant this permission in the screens that follow (shown below).

    Enable View And Control Permissions
  3. Grant File Access Permissions to VNC Server on Android
    Finally, click on File Access on the droidVNC-NG app configuration screen. Allow the app to access files on your android device, as shown below.

    Enable File Access Permissions
  4. Start VNC Server on Android
    Finally, hit the start button to start VNC server for Android. You will be presented with the warning screen shown below.

    Sensitive Information Casting Warning!!!

Carefully read and understand the implications prior to continuing. Once started, the Android VNC server should be listening for connections on the port you chose (5902 in this how-to).

Start Android Virtual Network Computing Server

In addition to the port number, you will also need the IP address of the Android device. As shown above, in this guide it is 192.168.1.120, which is the LAN IP address of my Android device.

If you are trying to access an Android system from outside your local network, then remember to setup port-forwarding on your router/gateway.

CONNECT TO ANDROID VNC SERVER

Now that our VNC Server on Android is running, let us see how to access the screen remotely. There are multiple ways to do this.

One of my favorite ways is to use Guacamole, which offers a HTML5 browser based access to VNC servers.

But for simplicity, in this guide, we are going to use TightVNC client for Windows. Using this VNC client app, we will view the Android device from my Windows system.

  1. Provide VNC Server details on the Client app
    Open the VNC client and provide the IP address and port number. In this case, they are 192.168.1.20:5902.
    Connect To Android Vnc Server Using Vnc Client

Wait!!! But the image above shows 2, and not 5902 for port.

As explained previously, VNC ports are usually in the range 5900 to 5999. For VNC ports, it is customary to provide only the incremental number from 5900. Therefore, for port 5902, the increment is 2. The TightVNC client app automatically trims the port number down to just the incremental number.

  1. Provide VNC Password
    Next provide the VNC password that you chose while setting up the VNC Server for Android.
    Enter Vnc Server Password

SmartHomeBeginner brings in-depth tutorials easy enough to understand even for beginners. This takes considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation.
3. Access Android VNC Server on Windows
You should now be able to remotely access and interact with your Android device. You could work on it and control it using your mouse (and keyboard) - mouse-click to select, click and drag to move screen or scroll, etc.

Android Interface Via Vnc Client On Windows

So there you have it - the full graphical interface of Android that can be remotely controlled from practically any platform.

FINAL THOUGHTS ON RUNNING A VNC SERVER ON ANDROID

While this is all fun to do, I want to share my experience in using VNC Server for Android without root. Simply put, the performance was not great and it was not a smooth experience controlling the Android device using a mouse. It was choppy and slow. And this was on my Pixel 3, which has decent specifications at this point (March 2021).

On older Android devices, the experience might be even worse. Nevertheless, the droidVNC-NG app works great, is really one of a kind at this point, and free to use.

There are alternatives such as the VNC Server app from XDA Developers. This app allows both wifi and USB access. Wired access may provide a smoother experience but I have not tried this yet. If you have tried this, I would appreciate if you share your experience in the comments.

Other than that, it was a fun and easy project to setup a VNC Server for Android and access it remotely.

树莓派android系统,无屏远程访问

当树莓派首次安装完Android系统,需要借助屏幕设置wifi密码(暂时没有其他好方案)。设置完成后,能够正常上网,后续操作可以在无屏的方式下,远程访问树莓派。
一般远程访问有多种方案,这里介绍两种方式:

  • vysor投屏
  • vnc投屏

准备工具

  • vysor
  • vnc viewer
  • droidVNC-NG
  • adb
  • mac book & pc

打开Android开发者设置

参考《树莓派安装Android操作系统

方式一:vysor投屏

vysor是一款手机投屏软件,通过PC控制手机。通过官网https://www.vysor.io/ 下载桌面版软件或chrome插件,安装完成后,启动软件。

  • 按照下图,连接adb server:

  • 链接成功后,如下图
  • 点击上图“播放”按钮,开始远程投屏

注意:

  1. vysor可以通过USB或wifi连接(需要收费)。
  2. USB是通过ADB方式连接,同一时间只能一个连接,如Android studio开发联调和vysor投屏会冲突。

方式二:vnc投屏

参考《树莓派android系统,vnc远程访问

mac远程连接raspberry

当身边没有显示屏或通过HDMI连接笔记本屏幕不成功时,本教程教你通过最少工具(无屏幕,鼠标,键盘),连接raspberry开发板。

准备工具

  • mac电脑
  • type-c电源线
  • sd卡
  • 读卡器
  • raspberry imager
  • raspberry OS
  • raspberry 开发板
  • tightvncserver
  • vnc viewer

安装Pi OS系统

根据如下视频,安装OS到SD卡

注意:

  1. 参考视频,烧录前,正确设置ssh和wifi的密码,方便通过mac直接远程ssh连接PI

启动系统

当SD卡烧录完成,插入开发版,并启动系统。

ssh连接开发板

查看开发板ip

参考《查看mac共享热点所有链接设备

连接开发板

通过mac,打开终端,输入:

1
ssh pi@开发板ip

安装tightvncserver

终端连接成功后,输入

1
sudo apt-get install tightvncserver

配置tightvncserver

终端输入

1
tightvncserver

此时会提示设置一个8位的登陆密码,以及是否view-only的选项,选no即可。
设置完成后,终端输出如下信息,表示成功

1
2
3
4
5
New 'X' desktop is hzz:1

Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/hzz:1.log

mac客户端vnc viewer连接

通过连接下载vnc viewer
安装完成后,打开vnc viewer,输入:开发板ip:端口,如上述:hzz:1,其中1表示连接端口

vnc连接成功后,如下图: