08:41 AM
Todd Ogasawara
Todd Ogasawara
Connect Directly

Microsoft on{X} For Android: A Visual Tour

Microsoft--yes, Microsoft--has a new Android programming platform called on{x} and it's great. Developed by the Microsoft R&D team in Israel, on{x} lets anyone turn an Android phone into an uber event-driven notification gadget.

on{x} is an Android app and companion website from Microsoft that lets you add notification capabilities to your Android phone. You simply download the on{x} app to your phone, then select from among various canned Java scripts (called "recipes") at the on{x} website. These scripts remotely program your phone to take actions when certain events occur. For example, you could have your phone automatically send a "Coming home" text to your significant other when you leave work, or tell you to take an umbrella when rain is in the forecast. You can write your own scripts or customize the canned ones to make your phone do other cool things, such as remember where you parked your car.

on{X} does not have all the features of Microsoft's other mobile development platform, TouchDevelop for Windows Phone, which has access to the camera API and even remote speech recognition and OCR servers. However, on{X} provides a much better development environment--the Web--and uses as its underlying language JavaScript, which is familiar to many Web developers.

The two sample images above demonstrate the revolutionary nature of on{x} programming, especially in a language as accessible as JavaScript. On the left are three on{x} events. The first event demonstrates a time-based event, but it also shows that it is easy to access other apps. The second event demonstrates a location-based event, as the program needs to know where you are--although it seems to us that you would want to be reminded to buy milk when you are out, not when you get home. The last event one shows a lot more: It identifies the person from contacts listed as boyfriend, it reads an SMS text, and it uses GPS to get the current location and send a reply text.

The image on the right is from the development environment and shows how on{x} programs can tell whether you are walking, running or driving, and fire off events based on that status.

To get started using Microsoft's on{x} service, you have to first download the app from its Google Play product page. You can see that two Samsung tablets as well as an older Android phone I have registered are shown as not compatible with the app.

The first thing you see after launching the app is a prompt to log in using a Facebook account. Bizarrely, there is no other authentication option.

The app starts off as a blank slate and instructs you to go to to add rules via the Web.

Going to takes you to Facebook where you are asked to allow the Facebook app to run under your account. It also reports how many friends (if any) as well as other people are using the on{x} app. There were 58 when I signed up.

There are 0 rules, or programs, defined at the start. You can try one of the canned "recipes" available for testing or write your own Javascript-based rules.

I tried the first recipe I saw, "Launch the music app when I am walking". Note that the words "music" and "walking" are highlighted. You'll see why these words are significant after clicking on the "<>code" button in the upper right of the window. on{x} can tell whether you are walking, still, or driving, and fire off rules accordingly.

The "<>code" button lets you see the JavaScript code for the recipe item selected. This lets you learn how to write using on{X}. "Music" and "walking" are global variables in the code for the "Launch the music app when I am walking" rule, shown above.

Adding a recipe or your own code instantly updates your Android phone. There is no manual syncing process to deal with. It just happens.

Unfortunately, the "Launch the music app when I am walking" script didn't work for my Android phone, a Nexus One. It's probably because the software underlying the modeOfTransport API call requires combination of an accelerometer and a gyroscope for determining when someone is walking--and the Nexus One does not have a gyroscope. So I decided to write my own script, above. on{X} code makes use of system triggers to create simple but potentially powerful and useful apps. I wanted a rule that would tell me when my phone's battery was fully charged. To do this, I wrote a script to make use of the "battery" API to trigger my code when a change in battery charge percentage is detected. My code checks if the battery is fully charged when a change occurs and then notifies me. Note that the code does not go into an endless loop when testing or if a charge is greater than 99% because the main trigger is the change of the battery charge level from 99 to 100%. The code inside of that trigger only gets executed when the charge level changes. The on{X} Web-based editor is very good. You can see from my screenshot that it provides syntax color coding. It also offers brace matching and syntax checking. It warned me I was missing a semi-colon.

Saving the code from the Web-based editor instantly updates your Android phone. You can see in the screenshot above that I updated the same piece of code twice in seven minutes.

Here is the on{X} rule I created, "Notify when battery is fully charged". Rules immediately start running. You don't have to do anything to activate them.

Tapping the Edit button in the upper right of the phone's screen lets you delete the rule. It's deleted on both the phone and the website.

Tapping the rule from the rule's main screen displays options to delete it, turn off the rule (without deleting it), or view logs for the rule. Log entries are created from within the rule using the "console.log()" function. My rule, for example, writes a log entry every time the Nexus One is fully charged. This lets me see the date and time for the end of each charging session.

Notifications pop up briefly at the top of the display. You can see the pull-down notification window version of the notification from my rule in this screenshot.

This screenshot shows the same notification from the on{X} rule itself.

on{X} has an amazingly rich set of API calls that can launch other apps, use the browser, deal with incoming SMS text messages, work with various phone call states (busy, incoming, etc.), and use location. It also can retrieve and work with external information feeds such as horoscope information, news, traffic, and weather.

It is no small irony that a Microsoft-developed programming platform is making me consider switching from a Microsoft Windows Phone to an Android phone. Want more info about on{x}? Watch the Microsoft Israel R&D Center Bing mobile team YouTube video below.

We welcome your comments on this topic on our social media channels, or [contact us directly] with questions about the site.
Comment  | 
Email This  | 
Print  | 
More Insights
Copyright © 2020 UBM Electronics, A UBM company, All rights reserved. Privacy Policy | Terms of Service