If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

GPS functions don't work

Hi guys,

 

I am working with GPS features on devices 9650, 8520, 9550,9300 and not I can make it work.

OS version: 5.0 and 6.0

 

Everything works very well on devices 9900 and 9360.

OS version: 7.0 and 7.1

 

Does anyone know of some reason to make this not work?

 

I am following the steps in the following example:

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Using-HTML5-Geolocation-in-your-...

Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: GPS functions don't work

Hi there!

 

What do you mean with "doesn't work"? Do you get the error that's in the code? Or no error and no location?

 

Are you sure that all those models have a GPS chip? You can't add non-existing features :smileyhappy: 

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Regular Contributor
liammccann
Posts: 68
Registered: ‎06-12-2012
My Device: Blackberry Bold 9780
My Carrier: Vodafone

Re: GPS functions don't work

Have you allowed it in the config.xml?

Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: GPS functions don't work

The application does not shows errors, the only thing is that it does not display the information:

I can verify that you have the support with the following code:

  //First test to see that the browser supports the Geolocation API
   if (navigator.geolocation !== null)
   {
      var options;
      navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, options);
   }
   else {
      alert("HTML5 geolocation is not supported.");
   }

 

 

But when I get my location displays me nothing simply says nothing with the following code.

 

  var options;
      navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, options);

 

 

 

What are the parameters in the config.xml that should change?

Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: GPS functions don't work

What do you have in the onSuccess function?
Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: GPS functions don't work

function geolocationSuccess(position)
{
   //Extract information about the users current position:
   var time = position.timestamp;
   var coordinates = position.coords;

   //Retrieve geographic information about the GPS fix:
   var lat = coordinates.latitude;
   var lon = coordinates.longitude;
   var alt = coordinates.altitude;
   var acc = coordinates.accuracy;
   var altAcc = coordinates.altitudeAccuracy;
   var head = coordinates.heading;
   var speed = coordinates.speed;

   alert("You are located at " + lat + ", " + lon);
}

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Using-HTML5-Geolocation-in-your-...

Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: GPS functions don't work

Did use the inspector to see step by step what is happening?
Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: GPS functions don't work

[ Edited ]

I have never used the inspector, it works on devices with version 5.0?

I have the following link, i'm going to go to testing

https://developer.blackberry.com/html5/documentation/ww_testing/web_inspector_overview_1553586_11.ht...

 

Why work on devices 9900 and 9360.

¿?

OS version: 7.0 and 7.1

Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

Re: GPS functions don't work

Inspector is part of webkit, so no, it won't work on OS5.
You can use other debugging techniques like javascript alerts :smileywink:
Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Trusted Contributor
chicoxml
Posts: 227
Registered: ‎09-03-2010
My Device: Not Specified

Re: GPS functions don't work

you have any simple example that works?.
this has me confused, add "try" to the code and shows no errors

:Surrender:

Please use plain text.