Mobile, Software Development

Javascript Reverse Geo options (that work outside the US)

A HTML5 mobile app that I was working needed to get the city and province (ie state for you non-Canadians) that the user was in. Using the HTML5 geolocation method made it easy to get the latitude and longitude. But the missing piece was how to translate that into city, county (if applicable) and province/state.

Google maps is the defacto solution in the geolocation space. But their API include a term that requires you to display their map as one of the conditions of using their API (see terms of service). This works for some apps but not always (and not in my case).

SimpleGeo is another popular option. What it has going for it is that there are very few restrictions and the API is very easy to implement. I was able to have code working in less than 30 minutes. The problem is that the data is really only good for locations in the US. If that works for your app, definitely take a look at this. When I tried it with some Canadian locations, there were gaps in the results and some were just wrong. Now to be fair, SimpleGeo is still in beta and maybe somewhere down the line, they will have better support for data outside the USA. Note, when using simplegeo, remember to allow either ‘*’ or localhost in the admin panel if you will be testing from your own machine or a mobile phone. The default is just ‘’ which will cause your API calls to be rejected.

The only other reasonable option left was Yahoo’s Placefinder API. Now, at first I didn’t expect Yahoo to have something that would be of use. They has been getting getting a trashing over the last year in the press. But as I started to look at the API, I realized that’s actually pretty powerful. And it seems to have good support for outside the United States. Definitely the data that I’ve tried for Canada has been very good. One thing to note is that Yahoo only allows 10K requests per day per app. If you need more than this, you need to contact them and work out an agreement.

The API is pretty straightforward to implement as its a simple HTTP GET. You can give it a latitude and longitude that you got from the HTML5 geolocation method and Yahoo will return all sorts of useful data about the location.

If you want to give the API a quick try, take a look at GeoPlanet Explorer web interface created by one of their ex-Developer Evangelists. In the ‘drilldown’ mode, locations are organized as a tree and the UI lets you see things like a locations parents (ie province & country) and it neighbours.

Have geocoding!


Getting Admob to Work with Rails3/Ruby19

When I tried to add Admob to my mobile site a few days ago, I discovered that Google/Admob’s ruby gem only works with Ruby 1.8.7 and Rails 2. Considering that Rails3 is was released earlier this year, it was surprising that the gem had not been updated. Anyways, as its open-source, I was able to get the code from rubyforge and make the required changes.

The new gem is called ‘admod19′ and can be installed easily by typing gem install admob19. If you would like to get the source, its on github at

For those that wand the technical details of the changes that I made, here is a list of what was updated.

  1. how session ID was accessed. session.session_id was changed to session[:session_id]
  2. updated MD5 calls to use new module name. MD5 is now Digest::MD5
  3. strip off any rack or rails headers in the request that is sent to Admob

Final note, follow the instruction in the gem’s README.txt file rather than what’s up on Admob’s site and you should be up and running quickly. Oh, and Admob is not returning ads, it’s possible they have no inventory. Easiest way to test that is to add an in-house add and have Admob use that whenever they don’t have an ad to server.


24 mobile operators aim to create an app store to rule them all

There has been some buzz yesterday about 24 of the worlds mobile phone carriers announcing that they will create their own app store (Wholesale Applications Community). We’ve known for a while that they are upset about being cut out of the revenue from app stores. My daughter as an example spends $20/month on iTunes. I know others who do the same. The phone companies definitely want to find a way to get in on the game.

Here is the announcement….

Now, the 1st question that I had was how would this fit in with my iphone which already has an app store (and a very good one I might add)? Will I have two app stores? The same can be said for anyone with a high end phone from Nokia, Microsoft, RIM or Palm.

If you look at the API used to create apps for this new app store, they are based on the BONDI APIs ( Apps are more like HTML widgets that can access the phone features (like GPS and address book, etc). Now to be really cross-platform means that we are talking about lowest common denominator so this is not HTML 5. In fact, the current engine (on the BONDI site) runs on Windows Mobile.

And this leads me to where I believe this app store will initially exist… on low-end feature phones. Sure it might be possible to run one of these apps on an iphone but why would I when there is probably a native app that is much better. This begs the question as to why the carriers want to have an app store for feature phones. The first part of that is that its the only game in town left. Here in North American that doesn’t look very exciting but in Asia its common for feature phones to have apps. And the carriers charge for them. In India, I saw feature phones where you could get your horoscope for 2Rs ($0.08) or check the cricket scores. And in India feature phones still rules as most people can’t afford a $600 for a (unsubsidized) phone when they make $300 a year. And remember India is a country with 350M mobile phones (and growing quickly).

And the second reason that the mobile carriers might want to do this is that eventually, HTML 5 will allow apps to be created that are as rich as native apps. At that time, a carrier app store might be able to take on a handset app store. As a developer, I would love to create one app that works on more than one type of handset.

So unless you have the ability to sell your apps in Asia (or Africa, etc), today’s announcement is not something that an app developer need to rush out and play with. But we should keep an eye on it. If the carriers don’t mess this app store up and HTML 5 does turn out to be what we hope it will be, maybe we’ll be very happy to develop for it in the future.

APIs, Mobile

Nokia new OS, Maemo gets detailed at conference

We’re right in the middle of the mobile API wars. Each major handset vendor has their own set of APIs and are trying to woo developers to create apps for their devices. Ever since the iPhone’s AppStore run away success, users are more and more looking to apps for all the cool extra functionality they want. So handsets without a vibrant app ecosystem are at a disadvantage.

Today Nokia’s Maemo conference started and the news coming out is encouraging. The first device, the N900 looks good and the software on it is promising. Maemo is based on Linux and today Nokia announced that Qt will be avialable for it. For all the Linux developers out there, this is probably the OS that is easiest for them to develop for. In fact, if done right, a bunch of the linux code created should be able to port very easily. Maemo is far and away a more compelling solution than Symbian, Nokia’s other OS. While Nokia’s strategy is looking more compelling, they still need to build an installed base. As a developer, there is no point in creating apps for a cool new device/OS if no one has handsets. Nokia needs to ship the N900 and get Maemo onto other devices ASAP. Without the installed base, only a few hobbist will be interested in Maemo.

Health, Mobile

fitbit – example of new class of net-enabled devices

Fitbit ( started shipping their new fitness and sleep monitoring device today. This device is cool for a number of reasons. First, on a functional level, you simply clip it anywhere on your clothing and it keeps track of how many calories your burned, how far you’ve traveled (walk or run) and even if you are getting a good nights sleep or not. All this information gets uploaded to their website where you can easily review the data. The device is very simple to use as in there is really nothing you have to do. It quietly collects data and then automatically uploads it when you are near the base station. So if you are having a hard time losing weight (who isn’t), you can easily see if you are doing enough exercise in relation to how many calories you are taking in.

The other reason I love this device is that it’s another example of the new class of devices that are net-enabled. Other examples is be
ecobee ( which is a home thermostat that uploads data to a website so you can see your energy usage over time.   There are other companies working net-enabled heart-rate monitors and even digital scales. The list of what’s possible is endless.  The biggest thing driving his is that most households now have broadband internet and adding wifi (or even a 3G cellular modem) isn’t that expensive anymore.

I’m looking forward to a whole bunch of new devices hitting the market in the next several years.