SMS Verification Codes Made Easy on Android V2!

SMS Verification Codes Made Easy on Android V2!
    Watch the video

    click to begin


    SEAN MCQUILLAN: With the SMS user consent API, you can prompt your user to share a single SMS message containing a one-time code. This is great because it means your app can do SMS verification without asking for permission to read every SMS message. From a user's perspective, the API will show a prompt asking if they want to share a single SMS message with your app. They'll see the entire text of the message, and if they accept, the message will be shared. You can then automatically complete an SMS verification flow. The user won't have to type the code. Instead, you can automatically extract it out of the SMS message. This reduces friction and lets the user get back to what they were trying to do instead of spending time typing out one-time codes. Before we dive into how to use the SMS user consent API, it's worth noting that you can also use the SMS Retriever API for the same user flow. It creates an even better user experience. The user won't even be prompted. However, it does require that you modify the SMS message to allow it to be automatically forwarded to your Android app. To learn more about the SMS Retriever API, check out the dev bite below. Enough background. Let's look at how to start using the API. The flow consists of several steps. First, you start SMS user consent, then Google Play services will receive the message and allow your app to prompt the user for consent to read the message. And then finally, once the user gives you consent, you can read the message with the one-time code. The API ships with Google Play services. Once you start it, it'll listen for any incoming SMS messages containing a one-time code and notify your app via a broadcast receiver when a new SMS message comes in so you can continue the user consent flow. You should always register this broadcast receiver dynamically in the activity or fragment that does your SMS flow, or you may have crashes on Android Q. Also note the sender address parameter. It's a knowable string which lets you specify which number will send the one-time code or allow any number by passing null. SMS user consent listens for new SMS messages containing a one-time code for 5 minutes after you start it. A one-time code is any four- to 10-digit alphanumeric string with at least one number. In addition, SMS user consent will ignore all messages sent by the user's contacts. That means you won't accidentally prompt the user to read their private messages. It's really important to note you need to start SMS user consent on the phone before the back end sends the one-time code. It won't ever read any messages received prior to starting SMS user consent. So once you've started it, tell your back end to send the one-time code. As it reaches the user's phone, SMS user consent will check if it matches the criteria. If it does, you can call the broadcast receiver you registered. At this point, your app doesn't have consent to read the message. The broadcast just contains an intent that you can use in startActivityForResult. When started, that intent will display the SMS user consent prompt to the user. If they click Allow, then your app will be passed the entire text of the SMS message through on activity result. You can then automatically complete the SMS verification flow by confirming the one-time code. When using the API, it's important you still provide your user a way to input the one-time code. That way if they're completing the flow on a different device than the one getting the SMS message, they can still complete verification. And that's it. That's all you need to do in order to implement the SMS user consent API. To learn more about SMS user consent and the SMS Retriever APIs, check out the links in the docs below. Thanks for watching. See you next time.
    UNREAL BUILDING TECHNOLOGIES THAT ARE ON ANOTHER LEVEL! ( New ) Free internet 100% Working - New Technology 2019 iOS VS Android - Did You Make The Right Choice? Primitive Technology with Survival Skills Giant fish trap in the wild beach (looking for food) 28 Days Build and Living in Secret Underground House The Future of Mobile Development Avicii Wake me up Lyrics Subtitulada en Español Letras Calm Around | Beautiful Chill Mix Is Java and Kotlin Development Dead for Android? NEW TECHNOLOGIES THAT WILL BLOW YOUR MIND