Showcase Your Business as a Thought Leader » Publish Your Blog, Videos and Events on ALL EC » Save 25% Now
Welcome Guest | Sign In

Following Microsoft's Recipes for Android Self-Programming

By Patrick Nelson TechNewsWorld ECT News Network
Jul 12, 2012 5:00 AM PT

Microsoft is involved in a project geared toward self-programming and extending the functionality of the Android smartphone environment. That's surprising, because Microsoft has got its own phone OS that competes.

Following Microsoft's Recipes for Android Self-Programming

However, on{X} (pronounced "on-ex") in beta is bringing some unique JavaScript APIs to the table that let you program your phone remotely.

How It Works

Javascript rules you create on the on{X} website are pushed to the phone. When they are triggered using phone functions like GPS, they run actions. Actions can include SMS text messaging, opening an app, and so on. Triggers can include GPS location, news and weather feeds.

on{X} uses the term "recipes" for its rules. Example recipes include turning the phone's Bluetooth radio on when you arrive or leave a location; showing you the weather forecast everyday at a specific time if the anticipated temperature is below a set level; and texting someone when you arrive or leave a specific location.

Recipes can be turned on and off at the phone.

If you've used the common website programming language JavaScript before, you'll find the whole process easy and can jump in. If you haven't, here follows a brief "how to" explaining the editing of a simple example recipe and getting it to work.

Step 1: Getting Started

Browse to the on{X} website using a PC and click on the "Get Started" link. Choose "Download the on{X} app" and follow the hyperlink that takes you to the Google Play store.

Install the app onto your Android smartphone. Log in to the phone app with a Facebook account.

Browse back to the on{X} website on the PC, and log in with Facebook. Choose your Facebook privacy settings here.

Select the "Recipes" tab on the PC website, and scroll down to the recipe sample: "When I arrive home, remind me to buy milk." This code snippet will form the basis for our test recipe and will use your location as defined by a variable to create a geo-region for a trigger. On entering the region, a notification will be initiated on the phone.

Click "Code" and the base source code will be displayed. Then click "Create new rule from source code."

Step 2: Your Location

Browse to Worldatlas or similar within a new browser tab on the PC (see below) and choose the "Quickly find the latitude and longitude" link.

Enter your current street address location, and the latitude and longitudinal coordinates of your location will be displayed in decimal position format -- the format used by on{X}.

You can also use a free GPS tool apps like Mictale's GPS Essentials or Chartcross's GPS Test to pull this data from your phone. Verify it's displaying in decimal format and not degrees by checking that the syntax is two digits followed by a decimal point followed by a series of digits.

Step 3: Your Code

Replace the existing latitude and longitude "initializing variables" in the on{X} source code with your data. Include six digits after the decimal point -- dropping any further digits generated by your source. The minus sign represents "W" in decimal notation.

Replace the text "buy milk" with something more interesting, like "open beer."

Reduce the geographic region's size by changing the radius (in yards) within the "geo region" to "500." This will mean you won't have so far to go when testing.

Change the rule name to "When I arrive home remind me to open beer," or whatever is appropriate, depending on the changes to the reminder verb and noun in the initializing variable.

Click "Save and Send to Phone." Then check the phone and your rule will be listed in the on{X} app on the phone.

Step 4: Testing

Test by leaving the perimeter you set earlier, and then returning.

Bear in mind GPS inaccuracies, and that the app utilizes sensor readings that take into account your motion. More motion equals more sampling. Verify the GPS stays alive while outside your perimeter.

Tips: Full documentation, including objects, further samples and a user forum are at the website.

Want to Ask a Tech Question?

Is there a piece of tech you'd like to know how to operate properly? Is there a gadget that's got you confounded? Please send your tech questions to me, and I'll try to answer as many as possible in this column.

And use the Talkback feature below to add your comments!

Patrick Nelson has been a professional writer since 1992. He was editor and publisher of the music industry trade publication Producer Report and has written for a number of technology blogs. Nelson studied design at Hornsey Art School and wrote the cult-classic novel Sprawlism. His introduction to technology was as a nomadic talent scout in the eighties, where regular scrabbling around under hotel room beds was necessary to connect modems with alligator clips to hotel telephone wiring to get a fax out. He tasted down and dirty technology, and never looked back.

How important is a candidate's knowledge of technology in winning your vote?
Extremely -- technology is at the center of most of the world's big problems and solutions.
Very -- a candidate who doesn't understand technology can't relate to young people.
Somewhat -- a general understanding is sufficient.
Not very -- choosing good advisers is more important than direct knowledge.
Not at all -- technology is often a distraction from more important issues.