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
New Developer
New Developer
Wai
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

4.6.0 Bold Simulator location is always 0

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.

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: 4.6.0 Bold Simulator location is always 0

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?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
New Developer
Wai
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

Re: 4.6.0 Bold Simulator location is always 0

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.

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: 4.6.0 Bold Simulator location is always 0

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.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
New Developer
Wai
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

Re: 4.6.0 Bold Simulator location is always 0

I have missed the second part.  It is working fine now.

 

Thanks so much for your time and help.

 

Please use plain text.