Microsoft’s publication of a new Android App on{X} (yes its no typo, Microsoft published an Android exclusive App) App for automating context-sensitive tasks with the use of simple user defined scripts (called recipes) was quite a surprise for me. on{X} (pronounced like ‘on-ex’) lets you control and extend the capabilities of your Android phone using a JavaScript API to remotely program it. These recipes are much the same approach i published within my PhD thesis, except the fact that in my work they were called rules (ECA = Event Condition Action Rules). Its good to see that finally this idea of letting users customize their smart devices to react context-aware on user defined situations, got general acceptance by big players like Microsoft.

In order to push user defined rules to your Android phone you just have to install the on{X} application on your Android phone, log in to the website and app, and push rules to your phone. Rules you create using the on{X} website are immediately sent to your phone using the on{X} application. The rules you create run on your phone, using the phone’s abilities such as GPS, text messages, phone calls, and more. The phone’s abilities are exposed in the on{X} API as Triggers and Actions (as i already mentioned before within the global community this concept was published as Event, Condition Action rules).

on{X} can be used to set specific triggers based on the phone’s sensors and abilities, which typically define the context in which the user and his/her phone are in the moment. A wide variety of triggers are described in our documentation. Some basic triggers are location, weather, time, news, battery and wifi (what about activity, acceleration, movement, sound, light, direction, photo, companions and friends, …?)

Finally, i have to admit that on{X} is a nice tool for every user of a smartphone and that Microsoft published a work that very much goes along with my own implementations in my PhD work (which was published in 2004).

So i downloaded on{X} from Google Play Marketplace ( i was one of the first 500 who already did that, which is quite amazing for a Microsoft App) and i started to create my first simple recipes/rules (its a little bit strange that these little snipplets of code are called recipes, but on the website and within the app they are called rules):

If you login to the on{x} website you get an overview of already uploaded rules/recipes on your smartphone. You can decide to either use a predefined rule that was already designed by the community or you can create your own context-rules.

set of predefined on{x} recipes

I chose a very simple predefined rule which shows hello world when you are unlocking your phone:

predefined on{x} rule which shows hello world on device unlock

I uploaded the new rule to my phone and voila, whenever i unlock my phone i get a hello world message in the notification bar.

Now i tried to create a more useful rule, which should show me the traffic jam messages when i start to drive my way home. So first have to set a trigger on a change in my way of transportation like this:

device.modeOfTransport.on('changed', function(signal) {
   if (signal.current === 'driving') {
      device.notifications.createNotification('Drive Safely!').show();

then i have to check the traffic feeds and show the result in the notification area like that:

var wps = [];
        // get the traffic my daily way home
        wps[0] = '48.368339,14.513798';
        wps[1] = '48.326583,14.311066';
        wps[2] = '48.044005,14.208498';
        // get the traffic feed
        console.info('about to call traffic feeds');
            {wps: wps, unittype: 'm'},
            function(traffic, textStatus, response) {
               console.info('\n****The traffic warnings are ' + traffic.warnings[0]);
               // duration is given in seconds, modify to minutes
               var duration = traffic.totalTravelDuration/60;
               var notification = device.notifications.createNotification('Traffic info');
               notification.content = 'Driving distance=' + traffic.totalTravelDistance + ' duration=' + duration + 'minutes';
            function(response, textStatus) {

So the parts combined resulted in a new recipe which i uploaded to my phone and looks like that:

If you would like to try on{X} for yourself and to discover some new rules, scan the QR code and go on testing…

If you have any cool rules or suggestions, please feel free to post them as comments below.

download the app

scan the QR code or enter
http://aka.ms/onxapp on your Android phone.
source: www.onx.ms

Leave a Reply

Your email address will not be published. Required fields are marked *