09-15-2008 10:59 AM
I am using the Bold simulator and MDS-CS from the JDE 4.6.0 I downloaded, the browser is working fine and can connect to the web sites. However, the Location object always returns 0 for both latitude and longitude properties.
Here is the code I used to obtain the latitude longitude information:
// called when location object changes
function locationCB() {
window.alert("locationCB: Latitude " + blackberry.location.latitude);
window.alert("locationCB: Longitude " + blackberry.location.longitude);
return true;
}
// test to see if the blackberry location API is supported
if (window.blackberry && blackberry.location.GPSSupported) {
this.document.write("GPS Supported");
blackberry.location.onLocationUpdate("locationCB()
blackberry.location.setAidMode(2); // I have tried 0, 1 and 2
blackberry.location.refreshLocation();
}
else {
this.document.write("This Device doesn't support the Blackberry Location API");
}
I manually refreshed the location information on the phone after using the environment command to set the location values (e.g. 43.0, -79.0). The phone was showing the correct value before I ran the web page.
Is this a known problem or I have missed something?
Any help is appreciated. Thanks.
09-15-2008 11:57 AM
Please try clicking on the Simulate menu and choose GPS Location. Do you see a change when you select a different location?
Within the BlackBerry Simulator you can verify the location by going to Options, Advanced Options, GPS and observing the GPS coordinates. Is this screen showing a non 0 value?
09-15-2008 01:04 PM
Yes, it does. The GPS Location is refreshed to the values I changed.
The values are changed using fledgecontroller Location(43.0,-79.0,0,-1), etc.
Thanks.
09-16-2008 02:16 PM
Does your page prompt you to allow GPS access? If not please ensure that the following are enabled in the BlackBerry Simulator.
JavaScript, to verify it is enabled:
1. Open the browser.
2. Select Options from the menu.
3. Select Browser Configuration.
4. Check off Support JavaScript.
JavaScript Location Support
1. Open the browser.
2. Select Options from the menu.
3. Select General Properties.
4. Check off Enable JavaScript location support.
09-16-2008 04:36 PM
I have missed the second part. It is working fine now.
Thanks so much for your time and help.