CommonStatusCodes.getStatusCodeString(resultCode)));
CommonStatusCodes.getStatusCodeString(resultCode)));
/** * Returns an untranslated debug (not user-friendly!) string based on the current status code. */ public static String getStatusCodeString(int statusCode) { switch (statusCode) { case GEOFENCE_NOT_AVAILABLE: return "GEOFENCE_NOT_AVAILABLE"; case GEOFENCE_TOO_MANY_GEOFENCES: return "GEOFENCE_TOO_MANY_GEOFENCES"; case GEOFENCE_TOO_MANY_PENDING_INTENTS: return "GEOFENCE_TOO_MANY_PENDING_INTENTS"; default: return CommonStatusCodes.getStatusCodeString(statusCode); } } }
CommonStatusCodes.getStatusCodeString(resultCode)));
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == BARCODE_READER_REQUEST_CODE) { if (resultCode == CommonStatusCodes.SUCCESS) { if (data != null) { Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject); QRURLParser parser = QRURLParser.getInstance(); String extracted_address = parser.extractAddressFromQrString(barcode.displayValue); if (extracted_address == null) { Toast.makeText(this, R.string.toast_qr_code_no_address, Toast.LENGTH_SHORT).show(); return; } Point[] p = barcode.cornerPoints; toAddressText.setText(extracted_address); } } else { Log.e("SEND", String.format(getString(R.string.barcode_error_format), CommonStatusCodes.getStatusCodeString(resultCode))); } } else { super.onActivityResult(requestCode, resultCode, data); } }
@Override public void onFailure(@NonNull Exception e) { // An error occurred while communicating with the service. mResult = null; if (e instanceof ApiException) { // An error with the Google Play Services API contains some additional details. ApiException apiException = (ApiException) e; Log.d(TAG, "Error: " + CommonStatusCodes.getStatusCodeString(apiException.getStatusCode()) + ": " + apiException.getStatusMessage()); } else { // A different, unknown type of error occurred. Log.d(TAG, "ERROR! " + e.getMessage()); } } };