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
Visitor
Posts: 1
Registered: ‎04-28-2010
My Device: Bold

Widget API - Gears Geolocation returning null

Hi,

 

I'm just starting to get to grips with the Widget API and trying to build my first widget using geolocation. However, I seem to be getting an error when trying to grab a location, namely:

 

"Attempt to get location failed: null"

 

Now, I'm guessing that 'null' should be replaced with an actual error message, so it seems that, for some reason, gears isn't loading properly. I've set up the GPS location in the device simulator, but no joy. Here's my code:

 

 

<html>
<head>
    <title>Fixmystreet</title>
    <link href="Styles/simple.css" rel="stylesheet" type="text/css" />
    <script type="text/JavaScript" src="Scripts/gears_init.js"></script>
</head>
<body>
<h1>Hello World</h1>
</body>
<script type="text/javascript">
  var geo = google.gears.factory.create('beta.geolocation');

  function updatePosition(position) {
    alert('Current lat/lon is: ' + position.latitude + ',' + position.longitude);
  }

  function handleError(positionError) {
    alert('Attempt to get location failed: ' + positionError.message);
  }

  geo.getCurrentPosition(updatePosition, handleError);
</script>
</html>

 

Any thoughts would be welcome :smileyhappy:

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

Re: Widget API - Gears Geolocation returning null

Hi There,

 

Can you post up the BlackBerry OS version of the Simulator that you are testing on?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Widget API - Gears Geolocation returning null

As an update, the simulators released with (JavaApps: 5.0.0.469) has  a defect in GPS, basically the GPS receiver can not get the simulated fix. 

 

Some simulators without this issue are: 

 

9500 Storm (v5.0.0.484)
9700 Bold (v5.0.0.545)

 

- 9500 Storm (v5.0.0.484)

- 9700 Bold (v5.0.0.545)

 

These can be downloaded here: 

http://na.blackberry.com/eng/developers/resources/simulators.jsp

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter