JavaScript methods to use location-based services

by Retired on ‎02-17-2010 10:56 AM (1,830 Views)


This article applies to the following:

  • BlackBerry® Device Software 4.0.2
  • BlackBerry® smartphones with Global Positioning System (GPS) capabilities


A number of JavaScript® methods were introduced in BlackBerry Device Software 4.0.2, which allows web developers to use location-based services, available on BlackBerry smartphones with GPS capabilities, in their web content.

The following methods and properties are available to developers to request GPS related information:

- Requests the BlackBerry location be updated.


blackberry.location.onLocationUpdate(var method)
- Registers a callback method to be called when the location changes.


blackberry.location.setAidMode(var aidMode)
- Sets the aid mode to be used: 0 = cellsite, 1 = assisted, 2 = autonomous


- Boolean value whether GPS is supported on this BlackBerry.


- The current longitude.


- The current latitude.