[Android] on{X} – automate your life

Lately, I’ve been obsessing over Microsoft. A couple of months ago, I would have told you that Windows 8 was a terrible move on Microsoft’s part. I had installed the Windows 8 preview in a virtual machine and found it difficult to use. After discussing Windows 8 quite a bit with my friend, Travis, I came to the conclusion that the VM made things difficult. My VM manager is VirtualBox and, unlike VMware, the ‘Windows Key’ is not intercepted by the Guest machine.

This month’s edition of MSDN Magazine is focused entirely on Windows 8. After reading about the WindowsMetadata architecture, I was hooked. I have been a .NET developer for almost 5 years now, and I think C# is one of the few languages to ‘get it right’. One of the things I’ve always loved about .NET is the Common Language Runtime (CLR), which allows developers to write in their language of choice while actually compiling down into a bytecode call IL (this is the heart of .NET).

WinRT takes it a little further. Instead of compiling into IL bytecode, WinRT exposes a native API, and the metadata acts as an adapter between the underlying native types and the types of the WinRT language being used. I was pretty stoked about this, so I decided to give Windows 8 a true evaluation.

After installing Windows 8 to physical media, I was pretty impressed with the operating system. Learning a few hotkeys like WINDOWS key, WINDOWS+X, WINDOWS+I, and WINDOWS+J makes things a lot easier, and I was missing out on these in the VM.

You’re probably wondering what that has to do with Microsoft’ on{X} application for Android? Well, it appears Microsoft has spent a great deal of time in unifying different languages and architectures recently. WinRT is one example. An Android application called on{X} is another. on{X} exposes underlying Android APIs to a scriptable (JavaScript) interface. I was intrigued by the idea, so I wanted to test a pretty simple recipe.

I’ve been bothered by the lack of customizable volume controls in Android for some time. I have a Samsung Galaxy with Android 4.1 running on it, and I *still* have no way to automatically reduce media and notification volume to nearly nothing between 11pm and 7am while still allowing phone calls.

The on{X} team has created a script which replies to missed calls with a specific message when you’re in a noisy place. Using this script as a guide, I created a script called Between 11:00 PM and 7:00 AM, 50% ringer for known contacts and 5% other audio:


After you enter this script into your dashboard on onx.ms, you can push it to your phone. The on{X} application scheduler will automatically load the script based on the timer definitions.

I plan to tweak this script a bit to store the previous ringer state in localStorage and to adjust the stored and current ringer states if the ringer volume is adjusted at any time during the bedtime period. It might also be nice to increase the volume only for phone numbers from contacts in a specific group like ‘Family’, ‘Important People’, or ‘Favorites.

Updated 2012-11-02: The above script now adjusts volume for incoming calls only if the calling party’s number exists as a contact

So, here’s the tie-in. It seems Microsoft is trying to unify a lot of things. With Windows 8, they’re trying to unify the mobile and desktop experience (Yes, it will probably take you a week to get used to it, but it’s worth it). With WinRT, they’re trying to unify the applicability and usability of all code; you can expose C# code to JavaScript in WinRT. With on{X}, they’re unifying API automation on the Android platform using a very popular dynamic language. For a company that historical has had a reputation for not ‘playing along’, Microsoft sure is making the game easier for developers in a lot of ways.

Related Articles