Saturday, October 11, 2014

Wear Shell - Exploring Android Wear

Having a LG G Watch for a while I thought that it would be interesting to run code directly on the watch without having to create an APK. Sometimes I just wanted to run some code snippets on the watch and view the result instantly.
Creating a complete project, compiling and deploying the APK on the Wear device is quite time consuming and somewhat annoying.

I tried to write an app to execute BeanShell code directly on the Wear device. This is all experimental and the possibilities are quite limited compared to an regular app, but for an execution of some code snippets that seemed to be a good idea.

The result is Wear Shell, an app that consists of a mobile and a Wear part. The mobile part moves the code for execution to the smart watch, collects the result and passes it to the calling application.

So I hope owners of an Android Wear smart watch have fun with the app and find it as interesting as I did to explore things from the perspective of a watch.

WearShell App


Web Interface

To make tests easier, the app contains a small (PAW based) web server with a web interface. Inside this interface you can type the code inside a text area, press the Execute button and wait for the result to be displayed.

Web Interface with Wear System Information


The web interface also contains a page containing code snippets for you to try out. These snippets include code for database, Bluetooth and system info access and should provide a good starting point for further explorations.

Developers

Developers have the possibility to use the functionality of the app within their own applications by using a Result Intent.

Action: de.fun2code.android.wear.shell.EXEC
Request String Extra: bsh
Response String Extra: result

Just pass the BeanShell code to execute to the bsh parameter and read the result from the resulting Intent.

Links 

Download: WearShell APK
Discussion: XDA Developers