After managed to get 3D Android Apps run on PC with AndroVM earlier, today i wanna share about getting AndroVM and AndroVMPlayer run in just a single click in single window. This tricks will hide all running window for running OpenGL display and show only the display window. We’ll need to write a Batch and VBS script and also install VBoxHeadlessTray to run VirtualBox VM on System Tray.
When using AndroVMPlayer for OpenGL windows, there are at least 3 running windows and 4 if you run AndroVM from VirtualBox. So that would be VirtualBox , the AndroVM it self, AndroVMPlayer console and AndroVMPlayer OpenGL display window run at the same time. Well, you can always minimize all the window if you want, but i prefer hiding rather than keeping them on taskbar. OK, enough for the preface, let’s continue to the steps (This article requires you to finish 3D Android Apps on PC steps).
VBoxHeadlessTray will run VirtualBox VM and put it on system tray. You can then right click the system tray to execute command such as reset, turn off and power up the virtual machine.
Just download VBoxHeadlessTray from here, and run the setup to install the software.
Beside running by clicking the icon, VBoxHeadlessTray can be executed directly from command prompt. And also you can specify which VM you want to boot from command line.
C:\Program Files\Topten Software\VBoxHeadlessTray\VBoxHeadlessTray.exe VM-name-here
VM-name-here is name of the Virtual Machine, in my case “androVM_vbox86tp_4.1.1_r4-20121119-gapps-houdini-flash”. Please note that VM name is case sensitive so you have to put exact name on it. I suggest you to rename the VM name from VirtualBox to any easier name, for example androVM. Now we need to add a shortcut to “VBoxHeadlessTray.exe VM-name-here” on desktop or any folder you like.
You can now run directly into Virtual Machine (in this case AndroVM) by double clicking shortcut.
Next we need to write a simple vbs script which execute and hide AndroVMPlayer console and let only OpenGL window opened. Open a text editor (i.e. notepad) and write the following single line code on it.
WScript.CreateObject("WScript.Shell").run "D:\path\to\AndroVMplayer.exe", 0, True
Save the script to .vbs file (i.e. androvmp.vbs). Since AndroVMPlayer run 2 windows, so when you run this script it will hide the first windows which is the console window. The console then execute an OpenGL display window which will not be hidden.
Important : Change “D:\path\to\AndroVMplayer.exe” to your real AndroVMPlayer.exe file.
Now let’s put them together into DOS batch file. The file will execute VBoxHeadlessTray shortcut we’ve created before, and the previous vbs script. Open new text editor and write the following script on it.
START D:\Master\Android\AndroVM\RunAVMP.vbs TASKLIST /FI "IMAGENAME eq VBoxHeadlessTray.exe" 2>NUL | find /I /N "VBoxHeadlessTray.exe">NUL IF "%ERRORLEVEL%"=="0" GOTO END START D:\path\to\VBoxHeadlessTray\ShortCut.lnk :END
Firs the line on batch script will execute AndroVMPlayer OpenGL display window, and then check on running application list for VBoxHeadLessTray.exe, if not it will run VBoxHeadlessTray shortcut, otherwise it will proceed to end. This way we can prevent duplicate VBoxHeadLessTray running the same virtual machine.
Important : change the shortcut lnk to the real path of your VBoxHeadlessTray shortcut (read shortcut to VBoxHeadlessTray).
Save this batch script into .bat file (i.e. AndroVM.bat) and put the file on desktop.
There is one problem on OpenGL display (it happened too on regular method) . If you close the OpenGL display for a long time while AndroVM still running on the system tray (background), it will sometime turned into the regular display. So when you start OpenGL display again, it will show nothing but black screen because AndroVM already run on its regular display.
The solution is by reseting the machine from system tray or restarting the machine (turn off and then power-up again). That’s all for today and have fun.