Skip to content

A library that simplifies the integration of the SMS Consent API. It enables verification code retrieval by displaying the SMS at the bottom of the screen, allowing users to stay within the app while viewing their verification code.

License

Notifications You must be signed in to change notification settings

burkido/auto-read-otp

Repository files navigation

SMS Consent API Library

SMS Consent API Library simplifies the process of integrating Google's SMS Consent API into your Android application. This library handles the complexities involved in requesting and retrieving SMS messages containing one-time passwords (OTP) and displays them within the app without interrupting the user experience.

Jitpack

Gradle

Add the dependency below to your module's build.gradle file:

dependencies {
    implementation("com.github.burkido:auto-read-otp:1.0.3")
}

Usage

Use the SmsUserConsent composable where you want to obtain SMS consent, such as in a screen with an OTP text field. You can see a sample implementation in the example app here.

SmsUserConsent(
    smsCodeLength = OTP_LENGTH,
    onOTPReceived = { otp ->
        Log.d("MainActivity", "SMS Received: $otp")
        code = otp
    },
    onError = { error ->
        Log.e("MainActivity", "Error: $error")
    }
)
auto-reader-otp-library.mp4

About

A library that simplifies the integration of the SMS Consent API. It enables verification code retrieval by displaying the SMS at the bottom of the screen, allowing users to stay within the app while viewing their verification code.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages