Help Center
Local Navigation
- GPS location information
- Specifying the source of GPS location information
- Retrieving GPS location information
- Specify a response time for retrieving the location of the BlackBerry device
- Retrieve the location information for a BlackBerry device
- Retrieve the speed of the BlackBerry device, in meters per second
- Retrieve the course of the BlackBerry device, in degrees
- Retrieve the number of GPS satellites that a BlackBerry device tracks
- Retrieve the time that a BlackBerry device application retrieved GPS information
- Maintain a connection with GPS satellites
- Get continuous GPS readings using the cell site mode
- Retrieve GPS information during a call
- Retrieve location information updates
- Change the criteria for obtaining location information
- Specifying a GPS receiver as the source for location information
- BlackBerry Maps location information
- Resources
- Glossary
- Provide feedback
- Legal notice
BlackBerry Manuals & Help
>
Documentation for Developers
>
Java Development Guides and API Reference
>
GPS and BlackBerry Maps - Development Guide - BlackBerry Java Development Environment - 4.7.0
Change the criteria for obtaining location information
- Import the following classes:
- Import the LocationListener interface.
- Implement the LocationListener interface.
- Create an instance of the Criteria class.
Criteria criteria = new Criteria();
- Invoke the setHorizontalAccuracy(), setVerticalAccuracy(), setCostAllowed(), and setPreferredPowerConsumption() methods of the new Criteria object to specify the new criteria.
- Invoke LocationProvider.reset() using the LocationProvider object with the criteria that you want to change.
provider.reset();
- Specify the LocationListener to null to unregister any LocationListeners that are currently associated with the LocationProvider object.
provider.setLocationListener(null, -1, -1, -1);
- Invoke LocationProvider.getInstance() using the new Criteria object as a parameter to create a new instance of a LocationProvider object. Assign the value that the method returns to the LocationProvider with the criteria that you want to change.
provider = LocationProvider.getInstance(criteria);
- Invoke LocationProvider.setLocationListener() to associate a new LocationListener
with the LocationProvider object.
provider.setLocationListener(locListener, -1, -1, -1);
Related tasks
Previous topic: Retrieve location information updates