Close Show/hide page

Virtual Trackpad for Android

What started out as a quick test with sockets inevitably grew into a fully baked app. I published this over the winter break, but have just pushed an update, making it free with all features unlocked.

This is a quick demo:

I chose to create the desktop client in Java with the hope of being able to share the socket communications code between the desktop and Android clients. This actually worked out, without even a need for any platform-specific conditionals. A pleasant surprise to say the least.

Additionally, since both projects are Java based, I was able to stay in the same IDE (IntelliJ), which was nice. The desktop project uses SWT (a long-time Java UI library that uses OS-specific dependencies to allow for native OS-based UI widgets) and builds four different JAR’s: Windows 32bit, Windows 64bit, OSX 32bit, and OSX 64bit (yikes). In the last step of the build process, a script packages the OSX versions into app bundles.

Cusor movement is done using the Java Robot class. You’ll see that the mouse cursor can have “momentum” on-unpress, which in practice can be super-useful. And mouse acceleration is configurable using this one-liner which I need to remember to find uses for more often:

double logBase(double value, double base) { return log(value) / log(base); }

The network logic is hand-rolled, using UDP sockets. The size of the encoded messages are kept as small as humanly possible. For example, a mouse-move command uses only 20 bytes — 4 bytes for a start-of-message token, 4 bytes for the command type (ie, move the mouse), two floats for the cursor position, and then 4 bytes for an end-of-message token. As a result, at least in my testing, under decent network conditions mouse-updating stays pegged at a steady 60hz.

> Google Play

4 Responses to “Virtual Trackpad for Android”

  1. JOHN says:

    you should put very clear instructions on how to install this on each OS. I’m stuck on windows sifting through all your libraries looking for the actual application for the desktop “companion” please help

  2. Wow, awesome blog layout! How long have you ever been running a blog for? you make running a blog glance easy. The whole glance of your web site is excellent, let alone the content material!

  3. la glutamina says:

    Que tal amigo, me encantaria que me dijeras donde puedo apuntarme para recibir las ultimas entradas de este blog, me gusta mucho. un saludo

  4. NexusUser says:

    Hi, is it possible that you add the possibility to connectd via bluetooth instead of WiFi?

Leave a Reply