JavaScript methods to use location-based services

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

Summary

This article applies to the following:

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


Description


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:


blackberry.location.refreshLocation()
- 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

 

blackberry.location.GPSSupported
- Boolean value whether GPS is supported on this BlackBerry.

 

blackberry.location.longitude
- The current longitude.

 

blackberry.location.latitude
- The current latitude.