Java Code Examples for com.google.android.gms.common.api.CommonStatusCodes#TIMEOUT
The following examples show how to use
com.google.android.gms.common.api.CommonStatusCodes#TIMEOUT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegistrationNavigationActivity.java From mollyim-android with GNU General Public License v3.0 | 7 votes |
@Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "SmsRetrieverReceiver received a broadcast..."); if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) { Bundle extras = intent.getExtras(); Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); switch (status.getStatusCode()) { case CommonStatusCodes.SUCCESS: Optional<String> code = VerificationCodeParser.parse(context, (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE)); if (code.isPresent()) { Log.i(TAG, "Received verification code."); handleVerificationCodeReceived(code.get()); } else { Log.w(TAG, "Could not parse verification code."); } break; case CommonStatusCodes.TIMEOUT: Log.w(TAG, "Hit a timeout waiting for the SMS to arrive."); break; } } else { Log.w(TAG, "SmsRetrieverReceiver received the wrong action?"); } }
Example 2
Source File: OtpBroadcastReceiver.java From react-native-otp-verify with MIT License | 6 votes |
@Override public void onReceive(Context context, Intent intent) { String o = intent.getAction(); if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(o)) { Bundle extras = intent.getExtras(); Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); switch (status.getStatusCode()) { case CommonStatusCodes.SUCCESS: // Get SMS message contents String message = (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE); receiveMessage(message); Log.d("SMS", message); break; case CommonStatusCodes.TIMEOUT: Log.d("SMS", "Timeout error"); mContext .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit(EVENT, "Timeout Error."); break; } } }
Example 3
Source File: PhoneNumberVerifier.java From identity-samples with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { if (intent == null) { return; } String action = intent.getAction(); if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(action)) { cancelTimeout(); notifyStatus(STATUS_RESPONSE_RECEIVED, null); Bundle extras = intent.getExtras(); Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); switch(status.getStatusCode()) { case CommonStatusCodes.SUCCESS: String smsMessage = (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE); Log.d(TAG, "Retrieved sms code: " + smsMessage); if (smsMessage != null) { verifyMessage(smsMessage); } break; case CommonStatusCodes.TIMEOUT: doTimeout(); break; default: break; } } }
Example 4
Source File: SmsBroadcastReceiver.java From react-native-sms-retriever with MIT License | 5 votes |
@Override public void onReceive(final Context context, final Intent intent) { if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) { final Bundle extras = intent.getExtras(); if (extras == null) { emitJSEvent(EXTRAS_KEY, EXTRAS_NULL_ERROR_MESSAGE); return; } final Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); if (status == null) { emitJSEvent(STATUS_KEY, STATUS_NULL_ERROR_MESSAGE); return; } switch (status.getStatusCode()) { case CommonStatusCodes.SUCCESS: { final String message = (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE); emitJSEvent(MESSAGE_KEY, message); break; } case CommonStatusCodes.TIMEOUT: { emitJSEvent(TIMEOUT_KEY, TIMEOUT_ERROR_MESSAGE); break; } } } }
Example 5
Source File: PhoneNumberVerifier.java From android-credentials with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { if (intent == null) { return; } String action = intent.getAction(); if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(action)) { cancelTimeout(); notifyStatus(STATUS_RESPONSE_RECEIVED, null); Bundle extras = intent.getExtras(); Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); switch(status.getStatusCode()) { case CommonStatusCodes.SUCCESS: String smsMessage = (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE); Log.d(TAG, "Retrieved sms code: " + smsMessage); if (smsMessage != null) { verifyMessage(smsMessage); } break; case CommonStatusCodes.TIMEOUT: doTimeout(); break; default: break; } } }