Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Carrier: Sprint

html 5 geolocation returns 0,0

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-WebWorks-Development/Using-HTML5-Geolocation-in-your-...

 

Any help is appreciated. Thanks.

Please use plain text.
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Carrier: Sprint

Re: html 5 geolocation returns 0,0

[ Edited ]

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?

Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 514
Registered: ‎07-18-2011
My Carrier: Rogers

Re: html 5 geolocation returns 0,0

Hi wolfie1,

 

What type of app are you making? A browser app or a webworks app?



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Carrier: Sprint

Re: html 5 geolocation returns 0,0

Browser app.  Thanks.

Please use plain text.
New Contributor
wolfie1
Posts: 8
Registered: ‎12-17-2011
My Carrier: Sprint

Re: html 5 geolocation returns 0,0

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....

Please use plain text.
BlackBerry Development Advisor
jeffheifetz
Posts: 514
Registered: ‎07-18-2011
My Carrier: Rogers

Re: html 5 geolocation returns 0,0

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.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Please use plain text.