Jul 15th, 2012

I can’t remember when or where I first read about on{X}, but for some strange reason I never spent any time with it. I finally got a chance to try it out over the weekend, thanks to a stupid bug that has me confined to my room.

So, what exactly is on{X}? The best I can describe it is as an IFTTT-clone for Android. There are two components to it, one being the app and the other a website. Once you’ve logged in with Facebook, you have the option to create a host of rules that allow certain actions to take place on your phone upon certain triggers. The on{X} team has provided a set of recipes for you to customize, such as

Text my wife “my phone’s battery is dying” when my phone’s battery goes below 15%


Set ringer mode to normal the first time I unlock my phone after 8:00 AM

You can customize these recipes as need be, such as replacing “my wife” with the name by which the contact is stored, or changing the value of the battery which triggers the action. And there are a wide range of triggers, from weather, to location, to movement, to time.

Where on{X} gets more fun (for me at least) is creating custom rules using Javascript. The API is pretty straightforward, and you can see the code of all the recipes they’ve shared. One rule that I created was to launch Any.DO if I unlock my phone after a gap of six hours, as long as it’s after 8 AM (which typically means I’ve just woken up). The code I’ve used is this:

// Initializing variables

var ringerMode = “normal”;
var time = “8:00 AM”;

// End of variables initializing

console.log(‘Started Script:’ + device.currentSource);
// Triggers the function when the screen unlocks
device.screen.on(“unlock”, function()
//var lastDateScreenUnlocked = device.localStorage.getItem(‘lastDateScreenUnlocked’);
var today = new Date().toDateString();
var dailyTime = new Date(today + ‘ ‘ + time);
var now = new Date();
// check if the time permits to set the ringer mode
if (now > dailyTime)
var lastScreenUnlocked = device.localStorage.getItem(‘lastScreenUnlocked’);
var lastScreenLong;
lastScreenLong = 0;
lastScreenLong = Date.parse(lastScreenUnlocked.toString());
var nowLong = Date.parse(now.toString());
var difference = now – lastScreenLong;
if (difference >= 21600000)
device.applications.launch(“Any.DO”, {}, function (error)
if (error !== null) {
console.error(‘failed to launch app  Any.do’, please verify the application name;’ + error);

// grab the shared storage
var storage = device.localStorage;

// set value and get the above two callbacks called
storage.setItem(‘lastScreenUnlocked’, now);

console.log(‘Completed Script:’ + device.currentSource);

It’s not something that would attract regular users, but those with knowledge of Javascript might be interested. As soon as you add a rule on the website, it’s pushed to your phone immediately as long as you have an internet connection. One point I must mention is that I saw someone mention in the reviews of the app that it requires an internet connection to perform the actions. That is not true. Unless an action itself requires an internet connection (such as checking the weather) it works perfectly offline.

There are a few bugs, though. One of the rules I’ve added have not been pushed to my phone for quite a while. Also, the app itself offers no manner to add even certain pre-defined recipes, which would have been nice. However, considering it’s in beta it’s definitely on the right track. There is a small but active community presence, so if the team behind it executes well enough, on{X} could garner a significant following. I’m definitely keeping this app for the Any.DO script I made, and the possibility to make more if I need them.

PS: I haven’t been able to test out whether the app is a battery drain, as happens so often with similar other applications. I’ll update the post once I come to a conclusion on that.