Tuesday, January 24, 2012

Location Weirdness

My current work project is a smart phone version of our mobile website. The fun part of this kind of development is working around the weirdness of a few mobile browsers, without breaking the functionality of the majority. The problem children more often than not are the Android phones, there is always one of them with some strange issue. Case in point, how the HTML 5 Location services are handled on the Motorola Droid 3. Don't get me wrong, the phone is great. It is dual core fast, has an amazing display, and a great keyboard. My problem is one of those things only a developer would ever know about.

The problem is about event generated when location tracking is denied by the user. Every other phone in our garage, generates a "LocationDenied", event in response. The Droid 3 generates a "LocationFailed". While these events are close, they are not the same thing. Location Failed is for when the phone unable to determine its location, for example when it is underground or something. Location denied is when the user has said, "No," to tracking. This little problem took me about half an hour to find and fix, but the bug isn't in my code, it is in the browser's.

So if you want to develop for the mobile web, be prepared for these kind of issues. JQuery, and JQuery Mobile can help to eliminate a lot of these kinds of issues, but not all of them. Be ready for weirdness.