Retrieve location information from GPS satellites using PDE
- Import the following classes:
- javax.microedition.location.LocationProvider
- javax.microedition.location.Criteria
- Create an instance of a Criteria object.
Criteria criteria = new Criteria();
- Invoke criteria.setHorizontalAccuracy(NO_REQUIREMENT) to specify that longitudinal accuracy is not required.
- Invoke criteria.setVerticalAccuracy(NO_REQUIREMENT) to specify that latitudinal accuracy is not required.
- Invoke criteria.setCostAllowed(true) to specify that this mode can incur costs for the BlackBerry® device user.
- Invoke criteria.setPreferredPowerConsumption(int level) using either POWER_USAGE_MEDIUM, or NO_REQUIREMENT as the parameter to specify power consumption is medium or not required.
- Invoke LocationProvider.getInstance(), storing the returned object in a LocationProvider object.
LocationProvider provider = LocationProvider.getInstance(criteria);
Was this information helpful? Send us your comments.