Skip to Navigation | Skip to Content



BlackBerry (Legacy) Browser and GPS | January 5th, 2011

I have been working on a BlackBerry mobile web application recently at Nitobi. It’s fairly complex in that it really pushes the abilities of the BlackBerry browser, and on top of this supports a lot of legacy BlackBerries. I’ve never been too fond of developing for this platform, just because of how hard it is to do common tasks like debugging, testing and reproducing issues. This project has taught me a lot: from being more strict with my JavaScript writing style and syntax, to finding workarounds for rendering issues, to getting better at testing on the extremely fragmented BlackBerry platform. However, one thing that stood out for me above all else was how poorly the BlackBerry JavaScript geolocation API behaved - thus, the birth of this post!

Before I begin, I want to say that my experience is based almost entirely off the older BlackBerry browser, not the new WebKit-based (Torch Mobile) browser. However, it wouldn’t surprise me if these issues existed on the Torch as it supports both the W3C Geolocation API and the BlackBerry Geolocation API simultaneously.

First, I’ve noticed that the browser will generally return 0 for both latitude and longitude when you request a location under certain circumstances:

  • If the BlackBerry is in a building or has no clear access to the sky (this is a given)
  • If you restart a device and do not access a Java-based application that queries for a GPS location, the browser will indefinitely return 0/0 as the location. What this means is that you have to open up, for example, the native Maps application, get a fix via it, before the BlackBerry JavaScript geo API will return meaningful data. Counter-intuitive, not obvious at all, not documented, but colloquial reports from other developers confirm these suspicions.

Second, some BlackBerry models do not ship with built-in GPS hardware. For an example, see this Wikipedia article and look at the 8520 (no GPS) vs. 8530 (GPS). Both 8520 and 8530 run similar BlackBerry OS versions, and thus, similar browsers. However, the BlackBerry JavaScript location API will return true when you query:

blackberry.location.GPSSupported

even for a device that has no GPS hardware! Furthermore, the location API methods will also appear to function (the location callbacks get fired, for example). To compound this problem further, the native browser application on BlackBerry allows the user to toggle JavaScript-based geolocation support on and off. What I’ve noticed on some of these models like the 8520/8530 is that this GPSSupported property returns true - even after I went in and specifically disabled JavaScript Geolocation support in the browser options.

Finally, some carriers actually disable location services on their devices (apparently Verizon does this - see last reply on first page of the linked forum post) and force you to
purchase a location-enabling add-on. No way to programmatically check for this in-browser, and also super dirty on Verizon’s part if true!

So in conclusion: although RIM’s documentation and API makes it seem like this is a reliable API to leverage in BlackBerry-targeted web apps, I find it’s hard to trust the BlackBerry JS location API in these cases, and that is a shame because this is our only avenue into GPS-aware functionality on websites targeting BlackBerries (especially older ones).

If you’ve noticed similar issues, I’d love to hear about it - drop me a line!

Posted in BlackBerry | No Comments » | Add to Delicious | Digg It

This entry was posted on Wednesday, January 5th, 2011 at 10:19 pm and is filed under BlackBerry. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply