Turning on and querying Location Services on the device
The Location Services option on the BlackBerry device controls the availability of location data. When the Location Services option is turned on, you can retrieve location information from any available location source (internal GPS receiver, external GPS receiver, and geolocation). When the Location Services option is turned off, location information is unavailable.
You can check if the Location Service option is turned on by invoking LocationInfo.isLocationOn(), which is provided in the net.rim.device.api.gps package. If the option is not turned on, you can programmatically turn it on by invoking LocationInfo.setLocationOn(). To turn on the Location Services option, your application must be signed and it must have permission to change the settings on the device. Make sure your application prompts the BlackBerry device user for permission to turn on location services.
When you invoke setLocationOn(), the following actions take place:
- If the Location Services option is turned off , the option is turned on, and location data from GPS becomes available, if the device supports GPS technology and the IT policy on the BlackBerry Enterprise Server permits access to the GPS feature
- Location data from the geolocation service becomes available, if the Location Data option on the BlackBerry device is enabled, the IT policy on the BlackBerry Enterprise Server permits access to the geolocation service, and the wireless service provider permits access to the service
- For external GPS receivers, location data becomes available if the external receiver is specified as the current GPS Data Source (in the Options on the device)