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.

inside custom component

Web and WebWorks Development

Reply
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Geo-Location JS API not working on BB

Are you able to post up your code.. it does take the device a few moments to gather a fix.  If you simply ask for the lat/long without adding a callback and then reading them there, it will return 0/0

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 4
Registered: ‎08-31-2010
My Device: BB Bold 9000
My Carrier: Rogers

Re: Geo-Location JS API not working on BB

I used the same code from the post above to retrive the result. Am I missing something??

Thanks

 

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Eclipse Plug-in Tutorial</title>
<script type="text/javascript">
function updateDate() {
var date = new Date();
document.getElementById("divDate").innerHTML = date.toDateString();
}
function locationUpdated() {//display the new location
var latitude = "unknown";
var longitude = "unknown";
var pf = navigator.platform;
if (pf == "BlackBerry") {
var support = blackberry.location.GPSSupported;
if (support) {//refresh the location
blackberry.location.refreshLocation();
latitude = blackberry.location.latitude;
longitude = blackberry.location.longitude;
}
}
document.getElementById("latitude").innerHTML = "Latitude: " + latitude;
document.getElementById("longitude").innerHTML = "Longitude: " + longitude;
}
</script>
</head>
<body onload="updateDate();">
Hello, the current date is:
<div id="divDate"></div>
<br />
<input type="button" value="Show Current Location"
    onclick="locationUpdated();" />
<br />
<div id="latitude" style="width: 200px; height: 20px;"></div>
<div id="longitude" style="width: 200px; height: 20px;"></div>
<div id="lblUpdate">
</body>
</html>

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Geo-Location JS API not working on BB

Can you also post the OS version that you are running on your Bold 9000

 

Is it OS v4.6 or v5.0?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
Posts: 4
Registered: ‎08-31-2010
My Device: BB Bold 9000
My Carrier: Rogers

Re: Geo-Location JS API not working on BB

It is v4.6.0.162(platform 4.0.0.155)

Highlighted
New Contributor
Posts: 4
Registered: ‎08-31-2010
My Device: BB Bold 9000
My Carrier: Rogers

Re: Geo-Location JS API not working on BB

Do you think v4.6.0.162(platform 4.0.0.155) is recent enough to retrive the Lat/ LNG information from the device??