on{X} Provides Userscript Like Customization for Your Phone

Wasn't really expecting this - Microsoft recently released an event driven API for mobile devices, it's only available on Android, you can only sign up with your Facebook account and the scripting language is JavaScript.


While I can't answer some of the questions this raises, I did take it for a quick spin. For a while, I've wanted some way to automatically check a route before my wife goes to work. The commute is all highway, so any incident drastically changes the drive time. I'm sure there's some application out there that does that (well, I assume there should be), but would it be automated? Can I easily set it to the two evenings she's on shift? How well can it be configured?

Here's how I did it with OnX in less than 100 lines of Javascript, for the most part copy and pasting from the Documentation. To keep the scrolling to a minimum it's just the main Function - check the gist out for the full script.

Right now OnX does a few things. It allows subscribing to events on the mobile device - things like an incoming call or SMS, changing unlock state, moving in or out of a geo-region. It also allows you to access information about the device, instead of subscribing and waiting for an event, various statuses can be queried - battery levels, location, network information. Finally, OnX provides an interface to act on the device - sending email or SMS, alerting the user, even opening applications.

OnX also includes a basic HTTP Client, making Integration with other APIs possible. There isn't any Callback/webhook support that I can find, so at this point any interaction must be initiated by the device.

Although describing new technology by saying it's like the "X" for "Y" is a bit overused, in this case it may actually be beneficial to describe on{X} as Userscripts/Greasemonkey for Android (and I have to assume it will find its way to Windows Phone). And while - like userscripts - it's possible to publish your scripts at any pastebin style site, on{X} also allows you to publicly publish your scripts on the site.

Since it's really a userland API, the contract developer in me doesn't see much usefulness for the projects I work on; however, the hacker/tinker in me is really looking forward to setting up interesting on{X} scripts, and seeing what other users build.

Be sure to read the next Mobile article: Amazon Launches GameCircle, a New Set of Gaming APIs and Services for Kindle Fire