In the following docs: https://developers.google.com/identity/sms-retriever/user-consent/request
it is stated a message triggers the broadcast only if it meets these criteria:
- The message contains a 4-10 character alphanumeric string with at
least one number. - The message was sent by a phone number that's not in the user's contacts.
- If you specified the sender's phone number, the message was sent by that number.
However it's not mentioned how to deal with the situation when any of the above criteria is not met and broadcast is not triggered. How do we conduct this to the end-user?
I am able to handle success and timeout cases and handling this situation would make the code more user-friendly.
switch (smsRetrieverStatus.getStatusCode()) {
case CommonStatusCodes.SUCCESS:
// Get consent intent
Intent consentIntent = extras.getParcelable(SmsRetriever.EXTRA_CONSENT_INTENT);
try {
// Start activity to show consent dialog to user, activity must be started in
// 5 minutes, otherwise you'll receive another TIMEOUT intent
startActivityForResult(consentIntent, SMS_CONSENT_REQUEST);
} catch (ActivityNotFoundException e) {
Log.d("Exception","ActivityNotFound");// Handle the exception ...
}
break;
case CommonStatusCodes.TIMEOUT:
Log.e("Timeout-Error:","Listened for msg for 5minutes");
break;
}