Handle errors (JSR 179)

If a request for a GPS fix is unsuccessful, you can retrieve the last returned error.
  1. Import the required class.
    import net.rim.device.api.gps.GPSInfo;
  2. Create a class and a constructor.
    public class handleGPS
    {
        public handleGPS()
        {
        }
    }
  3. 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;
    }

Was this information helpful? Send us your comments.