com.google.android.gms.auth.api.phone.SmsRetrieverClient Java Examples
The following examples show how to use
com.google.android.gms.auth.api.phone.SmsRetrieverClient.
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: EnterPhoneNumberFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
private void handleRequestVerification(@NonNull Context context, @NonNull String e164number, boolean fcmSupported) { setSpinning(register); disableAllEntries(); if (fcmSupported) { SmsRetrieverClient client = SmsRetriever.getClient(context); Task<Void> task = client.startSmsRetriever(); task.addOnSuccessListener(none -> { Log.i(TAG, "Successfully registered SMS listener."); requestVerificationCode(e164number, RegistrationCodeRequest.Mode.SMS_WITH_LISTENER); }); task.addOnFailureListener(e -> { Log.w(TAG, "Failed to register SMS listener.", e); requestVerificationCode(e164number, RegistrationCodeRequest.Mode.SMS_WITHOUT_LISTENER); }); } else { Log.i(TAG, "FCM is not supported, using no SMS listener"); requestVerificationCode(e164number, RegistrationCodeRequest.Mode.SMS_WITHOUT_LISTENER); } }
Example #2
Source File: SmsHelper.java From react-native-sms-retriever with MIT License | 6 votes |
void startRetriever(final Promise promise) { mPromise = promise; if (!GooglePlayServicesHelper.isAvailable(mContext)) { promiseReject(GooglePlayServicesHelper.UNAVAILABLE_ERROR_TYPE, GooglePlayServicesHelper.UNAVAILABLE_ERROR_MESSAGE); return; } if (!GooglePlayServicesHelper.hasSupportedVersion(mContext)) { promiseReject(GooglePlayServicesHelper.UNSUPORTED_VERSION_ERROR_TYPE, GooglePlayServicesHelper.UNSUPORTED_VERSION_ERROR_MESSAGE); return; } final SmsRetrieverClient client = SmsRetriever.getClient(mContext); final Task<Void> task = client.startSmsRetriever(); task.addOnSuccessListener(mOnSuccessListener); task.addOnFailureListener(mOnFailureListener); }
Example #3
Source File: AndroidUtilities.java From Telegram with GNU General Public License v2.0 | 6 votes |
public static void setWaitingForSms(boolean value) { synchronized (smsLock) { waitingForSms = value; try { if (waitingForSms) { SmsRetrieverClient client = SmsRetriever.getClient(ApplicationLoader.applicationContext); Task<Void> task = client.startSmsRetriever(); task.addOnSuccessListener(aVoid -> { if (BuildVars.DEBUG_VERSION) { FileLog.d("sms listener registered"); } }); } } catch (Throwable e) { FileLog.e(e); } } }