12-17-2011 10:55 AM
I've developed a web app that uses location detection, which works fine with Android, iPhone, and many desktop browsers; however, the latitude and longitude values are always returned as 0,0 on my blackberry. It is running OS 6 (it reports 6.0.0.415). Initially I was using google gears (the geo.js script), but after googling for a while I learned that gears doesn't support OS 6 (it only supports up to OS 5). So after doing more research I learned that OS 6 should just work with the standard HTML5 Geolocation API. However, this does not appear to be the case for me. I tried the code shown on this page, but the latitude and longitude still returns as 0,0. http://supportforums.blackberry.com/t5/Web-and-Web
Any help is appreciated. Thanks.
12-17-2011 12:18 PM - edited 12-18-2011 11:58 AM
I've now realized that if I first tickle the device to activate the GPS (e.g. via something like Google Maps), the code will work. But if you DON'T do this, you'll get 0,0 as your lat,long from javascript, no matter where you are. After awakening the device's GPS via something besides the browser (again, e.g. GMaps), you'll get legitimate values. Any ideas about what is wrong with the demo?
12-20-2011 10:03 AM
Hi wolfie1,
What type of app are you making? A browser app or a webworks app?
button below the post(s)12-21-2011 04:59 PM
Browser app. Thanks.
12-31-2011 09:52 AM
I can fix by editing geo.js. I swap the order of conditionals such that
'else if(typeof(window.blackberry)!=u && blackberry.location.GPSSupported)'
appears before
'else if (typeof(navigator.geolocation)!=u)'
Can anyone confirm that this is a safe fix? i.e. will it break other devices?
Thanks....
01-03-2012 02:31 PM
It should not break on other devices because you still have the undefined check first. But I'm quite surprised it doesn't work as is, since it does for me.
button below the post(s)