Help Center
Local Navigation
- GPS overview
- Specifying the GPS mode
- Retrieving a location provider
- Retrieving the location of a BlackBerry device
- Retrieve the location of a BlackBerry device
- Retrieve the location of a BlackBerry device by specifying continuous fix requests
- Retrieving location information by using the Location class
- Retrieving location information by using the BlackBerryLocation class
- Change the criteria to receive location information
- Error handling
- Handle errors (JSR 179)
- Handle errors (BlackBerry extensions to JSR 179)
- Geocoding and reverse geocoding
- BlackBerry Maps
- Glossary
- Provide feedback
- Document revision history
- Legal notice
BlackBerry Manuals & Help
>
Developer Documentation
>
Java Development Guides and API Reference
>
Development Guide
Location-Based Services - BlackBerry Java Application - 5.0
Handle errors (JSR 179)
If a request for a GPS fix is unsuccessful, you can retrieve the last returned error.
- Import the required class.
import net.rim.device.api.gps.GPSInfo;
- Create a class and a constructor.
public class handleGPS { public handleGPS() { } } - In the constructor, invoke GPSInfo.getLastGPSError() to retrieve the error.
switch (GPSInfo.getLastGPSError()) { case GPSInfo.GPS_ERROR_NONE: break; case GPSInfo.GPS_ERROR_ALMANAC_OUTDATED: break; case GPSInfo.GPS_ERROR_AUTHENTICATION_FAILURE: break; case GPSInfo.GPS_ERROR_CHIPSET_DEAD: break; case GPSInfo.GPS_ERROR_DEGRADED_FIX_IN_ALLOTTED_TIME: break; case GPSInfo.GPS_ERROR_GPS_LOCKED: break; case GPSInfo.GPS_ERROR_INVALID_NETWORK_CREDENTIAL: break; case GPSInfo.GPS_ERROR_INVALID_REQUEST: break; case GPSInfo.GPS_ERROR_LOW_BATTERY: break; case GPSInfo.GPS_ERROR_NETWORK_CONNECTION_FAILURE: break; case GPSInfo.GPS_ERROR_NO_FIX_IN_ALLOTTED_TIME: break; case GPSInfo.GPS_ERROR_NO_SATELLITE_IN_VIEW: break; case GPSInfo.GPS_ERROR_PRIVACY_ACCESS_DENIED: break; case GPSInfo.GPS_ERROR_SERVICE_UNAVAILABLE: break; case GPSInfo.GPS_ERROR_TIMEOUT_DEGRADED_FIX_NO_ASSIST_DATA: break; case GPSInfo.GPS_ERROR_TIMEOUT_NO_FIX_NO_ASSIST_DATA: break; }
Parent topic: Retrieving the location of a BlackBerry device