RefBan

Referral Banners

Yashi

Friday, June 8, 2012

Supercharge and Automate Your Android Phone with On{X}

June 8th, 2012Top Story

Supercharge and Automate Your Android Phone with On{X}

By Melanie Pinola

Supercharge and Automate Your Android Phone with On{X}Let's say every time your significant other sent you a text that said "Where are you?", your phone automatically replied with your location. Or maybe you want your phone to automatically send an "I'm on my way" text when you leave work. Or, perhaps in an effort to get in better shape, you tell your phone to bug you if you haven't been to the gym in the last three days. All of these (and many more) handy, automated processes are possible with on{X}. Here's how it works.

In this post, we'll walk through how to use on{X}'s easy to use pre-made rule templates to get your phone to do things automatically, like remind you to take an umbrella if it's going to rain. Here's how to get more out of on{X} using those "recipes", and if you're so inclined, we'll also walk through how to code your own JavaScript instructions for your phone.

About on{X}

Supercharge and Automate Your Android Phone with On{X}On{X} is a rule-based automation app developed by (of all people) Microsoft that works with your Android phone. On{X} currently offers nearly a dozen recipes to automate your phone. Like other automation apps they depend on a trigger (the time or a change in location, for example) to create an action (a notification on your phone or opening an app).

Some of the best pre-baked recipes include these automated instructions:

As you can see, the app works as a kind of personal assistant—reminding you to do things—and can cut down on repetitive (time wasting) actions like opening your calendar when you get to work.

Each of these rules are customizable and you can also dig into the code to create new rules based on them.

Similar to Tasker, another app that can automate really cool things, on{X} allows you to easily create rules on the on{X} website, which then sync to your phone. The on{X} recipes interface for adding or editing rules is extremely intuitive (akin to webapp automator ifttt), so it's easy for anyone to add a new automated action to their phone. As an added bonus, if you know how to code in JavaScript, you can edit or create brand new rules to your liking.

Set Up On{X}

Before you start using it, you have to complete a few simple steps to get started with on{X}:

  1. Download and install on{X} from the Android market or by scanning this QR code
  2. Log into the app on your phone with your Facebook login. (After you log in, you actually never really need to use the app on your Android phone, although you can use the app to toggle recipes on, off, or delete them.)
  3. Lastly, log into the on{X} web site, again with Facebook.

Visit the recipes page on the on{X} site, click on the ones you want to add, and hit the "add" button. Voila! The recipe will be pushed to your phone. It's that easy!

Well, almost that easy. In order for your phone to know, for example, that you've reached home, or left work, you may need to do some slight customizations.

Customize On{X} Recipes

Editing an on{X} recipe is easy. You can change any variable that's highlighted, and you can select other options then add the rule to your phone.

Supercharge and Automate Your Android Phone with On{X}Take the "When I arrive home remind me to buy milk" recipe, for example. It's kind of silly to be reminded to go out for milk once you're already home, so you can change that rule by clicking on it, then changing "arrive" to "leave" via the drop-down and "home" to your "work" latitude and longitude coordinates (Bing Maps conveniently displays latitude/longitude when you look up any address). Change the "milk" prompt also to whatever it is you're supposed to remember to pick up. Then hit "Add" and the rule is immediately activated on your phone.

Similarly, you can change the time, message, apps, website, and most other details in these recipes. So instead of: Launching the music app while walking, you can launch the maps app when you're driving. Instead of texting your wife you're on your way when you leave work, you can text anyone when you arrive at the airport. Just plug in your own details for those highlighted variables.

This super-simple customization is the app's biggest selling point.

Find More On{X} Recipes from Other Users

Users can also code their own recipes and share them with others (after on{X} approves the recipes). With the service being brand new, there aren't a lot of shared recipes just yet, but you can find some code examples and a good bit of coding discussion in the on{X} forums.

Some useful recipes include:

To add these recipes to your phone, go to "write code" in your on{X} menu on the website, then paste in the code from one of these recipes. Edit the variables to match your preferences (e.g., your location or time) and then simply save the script to have it sent to your phone.

Modify On{X} Recipes by Editing the Code

Because the code behind all of the on{X} recipes is just one click away, you can use the recipe templates as a base for coding your own rules in JavaScript. You can also look up code examples in the on{X} documentation. (If you're just starting out coding, see our Learn to Code Night School and other resources for getting started with the basics if any of the terms are confusing.)

Let's say you want to know every morning if your commute is going to be longer than normal. There's no standard template for that, but you also don't have to start from scratch. The "Show me the Aquarius horoscope every day at 9:00 AM" is very similar—instead of the horoscope, you're asking your phone to show you what traffic will be like. The on{X} documentation shows there are feeds for news, traffic, and weather in addition to the horoscope feed.

Click on that horoscope recipe's "< > code" link at top right to get a look at the script. Then click "create new rule from source code" to start editing the code.

Peeking at the horoscope code, variables that you can change are your horoscope and the time for the notification. Delete the horoscope sign variable (line 3), since we don't need it, and change the time (line 4) to for whenever you want to get your traffic alert (e.g., half an hour before you usually leave home for work or before you head home).

For the console logging ("console.log" on line 8), change the text from "Started script: Show me the horoscope every day" to "Started script: Show me the traffic to work every day".

Next, we don't want to show the daily horoscope, so delete the "showHoroscope" function (lines 10 through 25).

Supercharge and Automate Your Android Phone with On{X}

Then in place of what we've deleted, we'll insert the code to set the traffic coordinates and get the traffic feed. The on{X} documentation has instructions and an example for using the traffic feed. Copy the lines that start with "// get the traffic for I-90 ramp in Bellevue to I-5" and include the array called "wps" that sets your traffic start and end points. Paste them into the horoscope template, where the variables are declared. Edit the location coordinates to be your start and end points (home and work, for example. Again, Bing Maps can quickly get you an address' latlong coordinates).

Finally, copy the traffic feed function from the documentation ("feeds.traffic.get") to the code in place of the "showHoroscope" one. This code displays a notification on your phone with driving distance in miles and duration in minutes. (If you don't care about the driving distance, you can delete this part of the notification.content: "distance=' + traffic.totalTravelDistance + '".)

Supercharge and Automate Your Android Phone with On{X}

Click "save and send to phone" to create your rule. Thus at your designated time, you'll get the estimated travel time between your two locations, which should take into account traffic conditions. You can publish your rule for on{X} to consider making public for others to use.

This is just one example of how you can create new rules by copying and editing code from the documentation or what others have shared. You can also start from scratch if you like, building on a basic "Hello World" example code.

(By the way, I've added the full recipe on Pastebin. It could definitely use some work, like showing traffic warnings. If you have any improvements, let me know.)

On{X}: Full of Possibility

Right now, on{X} is very much a beta app. The recipe templates are really intuitive to use, and the open API makes it easy to code and share rules, but there are still limits to what you can do. Some essential controls—such as ringer volume/vibration, Wi-Fi and GPS signal, and screen lock—are still missing. But these are sure to come and, for now, there's still lots you can do and explore with both the recipes and the JavaScript API.

Got any ideas for cool on{X} recipes? Share them with us in the comments.

Number of comments

No comments:

Yashi

Chitika