How to Use the Geolocation Service

by Retired ‎07-19-2010 12:13 PM - edited ‎09-16-2010 03:02 PM (10,313 Views)

The Geolocation service is able to get a location fix in seconds using cell tower triangulation. This is a service hosted by RIM and is offered for free to all developers.


This allows your BlackBerry smartphone applications using GPS to function even when the BlakcBerry smarthphonehas no GPS coverage.Users can be in a tunnel with no GPS coverage but your app will still be able to guide them to the good restaurants or to other points of interest (POI) around them. Although the accuracy of the fixes obtained from the Geolocate Service is low, there are use cases for both apps that require highly accurate GPS fixes as well as apps that do not. For apps that needs accuracy, one can use this service to quickly show the user an approximate location while it waits for an accurate location fix using GPS. This can be easily a huge improvement in the user experience of your app. On the other hand, apps that are not concerned about accuracy can use this service as their primary mode of operation.


To take advantage of this Geolocate Service, all you need to do is ask for a fix via your LocationProvider or BlackBerryLocationProvider using the appropriate Criteria or BlackBerryCriteria. Please note that this service needs BlackBerry OS 5.0 or above and users must be signed up with a carrier that has enabled these capabilities. The following sample code snippet shows how to obtain a Location object using the Geolocate Service.



BlackBerryCriteria bbCriteria = new BlackBerryCriteria();
BlackBerryLocationProvider bbProvider = (BlackBerryLocationProvider)LocationProvider.getInstance(bbCriteria);
BlackBerryLocation bbLocation = bbProvider.getLocation(120);


Please note that, on CDMA devices, if the carrier natively supports Cellsite mode, the carrier’s cellsite service takes priority over RIM’s Geolocate Service. However, on GSM based devices, Geolocate Service is used by default.