Skip to content

AndroidX11Server

qindel edited this page Dec 23, 2012 · 3 revisions

Xvnc X/X11 Server with VNC backend

Introduction

This is an implementation of an X Server for Android.

''Note'': This application is no longer mantained although it seems pretty stable now, it is still kept here for your convenience. You can find new versions in xnvcpro: X X11 Windows server, or use the qvdclient embedded X server using menu→Xvnc Console. QVD is a VDI platform which allows you, among other things, to bring Linux Apps to your phone.

Check also the Xvncpro manual at http://theqvd.com/support/documentation

You should be able to download the package from https://market.android.com/details?id=com.theqvd.android.x

This work has been sponsored by Qindel for their QVD project, which I credit here http://theqvd.com

FAQ

How do I use it:

  • Launch the X server

  • Use connectbot or other ssh client that allows you to do port redirection.

  • Try to connect to your desktop with your username and password.

  • logout

  • Long press on your connection until a menu pops up. Click on edit port redirection

  • Put in:

  • your username

  • Type: remote

  • source port: 6010

  • Destination: localhost:6000

  • Connect again. And from your terminal session type:

    export DISPLAY=localhost:10
    xlogo &
    xterm &
    icewm &

How do I test it

Here is how I tested it:

  • I launched the X server

  • Then I sshd into my android box with port redirect. For that you need an ssh server I used SSHDroidPro.

  • Run the following from your terminal

    ssh -L 6001:localhost:6000 root@yourandroiddevice
  • From your desktop computer try the following:

    export DISPLAY=localhost:1
    xlogo &
    xterm &
    icewm-session &

The mouse does not follow the whole screen

Click on the menu in the VNC screen and select Input Mode Mouse Pointer Control Mode or Touchpad

How can I invoke it from my own X application

You should also be able to launch from your application with the following Intent x11://localhost:0

Be aware that currently only the scheme is used. listening on localhost and on display :0 is currently hardcoded, so if you try something like x11://localhost:1 or x11://10.0.0.1:0 will still launch x11://localhost:0. If you really have a need for this let me know and I change it.

Example code:

public class MainActivity extends Activity {
  private Button buttonLaunchX;
   static final String tag = "XtestIntent-MainActivity-" +java.util.Map.Entry.class.getSimpleName();
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
buttonLaunchX = (Button) findViewById(R.id.button1);
       buttonLaunchX.setOnClickListener(new Button.OnClickListener() {
       				     public void onClick(View view) {
       				     	    String cmd = "x11://localhost:0";
       					    	   Log.i(tag, "launching intent:"+cmd);
       						   	      Intent x11Intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(cmd));
       							      	     startService(x11Intent);
       								     }
       });
   }
}

How can I request the installation from my application

Use this code:

public boolean installXifNotInstalled() {
   ApplicationInfo info;
   String packagename = "com.theqvd.android.x";
   try {
     info = getPackageManager().getApplicationInfo(packagename, 0 );
   } catch( PackageManager.NameNotFoundException e ){
     Log.i(tag, packagename + " is not installed");
     Intent goToMarket = new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://details?id="+packagename));
     startActivity(goToMarket);
     return false;
   }
     Log.i(tag, packagename+" is already installed" + info);
     return true;
   }

The X server is listening on all interfaces

Currently it is not supported to bind to the localhost/127.0.0.1 address. As a workaround during the launch of the Xvnc binary the "-localhost" option is passed disallowing the access to the X server from addresses diferent of localhost

Install

The installation has the following steps:

  • Copy the Xvnc binaries to the local storage

  • Install Android VNC (at the moment of this writing it is free)

Execute

To execute click on Start X server.

You should also be able to launch from your application with the following Intent x11://localhost:0

Uninstall

Currently the binary is packaged inside the application and it is deployed in the following location:

/data/data/com.theqvd.android.x/

The binaries stored in this location do not get deleted on uninstall.

If for some reason you want to reinstall the application just delete the following file and restart the application:

/data/data/com.theqvd.android.x/shared_prefs/PREFS_PRIVATE.xml

Components

  • XVnc binaries, installed in /data/data/com.theqvd.android.x/usr/bin

  • Android Application. This is what you get from the market it is used to install the application, request the installation of AndroidVNC, …​

  • AndroidVNC Application. This is launced from the X server with the following Intent: vnc://localhost:5900/C24bit/ben1to

CREDITS & License

The XVnc server is distributed under the GNU Public License Version 2.

The Android Application is distributed under the GNU Public License Version 3.

It was developed by <Nito at Qindel dot ES> and sponsored by the QVD project http://theqvd.com

Clone this wiki locally
You can’t perform that action at this time.