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
Highlighted
Contributor
Posts: 35
Registered: ‎12-28-2010
My Device: Bold 9780
My Carrier: Orange UK

Geolocation not supported within web worker?

I have a simple test app which launches a web worker to check geolocation.  The worker code is below.  In Ripple, and on my OS6 Bold (9780), navigator.geolocation returns null.  The exact same code operating in the calling html page works fine and returns the location.  (I can post the code if you like but it's pretty simple).

 

Is geolocation not supported in a web worker?

 

 

if (navigator.geolocation == null)

    postMessage("navigator.geolocation is null");

else

    navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError,'');

 

function geolocationSuccess(position) {

    postMessage("Location: " + position.coords.latitude + " "+ position.coords.longitude);

}

function geolocationError(posError) {

    postMessage(posError.message);

}