Android Geolocation

The adoption of HTML5 and its surrounding cast of powerful new features is going to be a huge boon to web users and points towards a very positive direction for the future of the web. From the smoother interfaces of canvas, local storage enabling offline modes for online email programs and the like seamlessly, online video free of dependencies like Flash, web sockets making the real time web a breeze without all the current AJAX workarounds, and so much more but I'll save all of those for future posts....

Today I wanted to finish up and release an experiment using the HTML5 Geolocation feature (sticklers, click here), a feature allowing your web browser (with your permission of course) to share your location, enabling any current website to tailor itself right to where you are... a powerful feature for todays increasingly mobile web user.

Why is This Important?

Today this level of convenience, all the applications you use every day seamlessly knowing where you are, is unheard of for the user as well as the web developer outside of proprietary built "apps" on iPhone or Android you need to seek out and download. But little do most people know those web browsers in their pockets on those same devices can do this today, opening the playing field of a personal local experience up to the entire web... no downloads, no waiting, no device lock-in.

The Experiment

My experiment started with a simple need, in the summer I drive a Jeep to work with a soft top and I prefer to have it down as much as possible, I mean sun in Minnesota only happens for a short stint i need to suck it up. What I needed was a simple view of the current temperature, maybe a radar map to look for any rain on the map coming my direction, not a huge list. In the early summer I quickly built a one page HTML and JavaScript mashup using jQuery, HTML5 (or Google Gears as a fallback) and the Weather Underground API to build a web page that did just that, polished it up a bit (let's call it a working prototype as of today) and hosted it on Google App Engine purely for worry free scalability to show it to you all.

Android, iPhone Geolocation Weather GEO

Android, iPhone Geolocation Weather GEO

It passes that longitude and latitude back to my page's JavaScript I in turn query Weather Underground for the next two forecast elements and a radar map for that longitude and latitude and display them as soon as they come back...

Android, iPhone Geolocation Weather GEO

Pretty slick... solves a problem in a simple way, just one click from a browser bookmark, no custom proprietary "app" code to build and it will work in every browser when HTML5 is fully adopted, but currently works in the major mobile browsers, Android and iPhone, in FireFox 3.5+ and any browser that has Google Gears on the PC, Mac and Linux... thats more than enough for me.

A great example of where the web is going and how progress on open standards like this benefit everyone, give my little experiment a try here Let me know how it works for you, if your device is passing your proper location and what you think in the comments. Currently I am seeing the Droid have a problem with the code and have posted to the Android Developers Google Group.

Android Geolocation Weather GE

* Ok, technically Geolocation is part of the W3C Geolocation Working Group, not HTML5 but it will largely be implemented with HTML5 so it really has become part and parcel of the browser based future.