Skip to content

Instantly share code, notes, and snippets.

@johnboxall
Created October 5, 2010 17:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnboxall/611920 to your computer and use it in GitHub Desktop.
Save johnboxall/611920 to your computer and use it in GitHub Desktop.
// BlackBerry Geolocation. Tested w/ 4.6.0.297.
// http://docs.blackberry.com/en/developers/deliverables/1143/browser_devguide.pdf
if (window.blackberry && blackberry.location && blackberry.location.GPSSupported) {
var AUTONOMOUS_AID_MODE = 2;
function win() {
clearTimeout(failTimeoutId);
blackberry.location.removeLocationUpdate(win);
alert(blackberry.location.latitude + " : " + blackberry.location.longitude);
}
function fail() {
blackberry.location.removeLocationUpdate(win);
alert("Couldn't find your location.");
}
blackberry.location.onLocationUpdate(win);
blackberry.location.setAidMode(AUTONOMOUS_AID_MODE);
blackberry.location.refreshLocation();
var failTimeoutId = setTimeout(fail, 1000*30);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment