Auto Read SDK
The OTPLESS AutoRead SDK simplifies the process of automatically reading OTPs from SMS, WhatsApp ZeroTap or WhatsApp OneTap, enhancing the user experience in your Android applications.
Prerequisites
If you are already using OTPLESS SDK for authentication, then you don’t need to use AutoRead SDK because OTPLESS SDK auto reads the OTP itself. AutoRead SDK is to be used by merchants using OTPLESS APIs or some other vendor for authentication.
WhatsApp OTP AutoRead
- Get the OTP message template whitelisted by OTPLESS Support Team for OTPs that the users will receive on WhatsApp.
- Make sure the app hash that is whitelisted by OTPLESS matches your app hash at application runtime. If the app hash is different from the whitelisted app hash, WhatsApp OTP AutoRead won’t work. You can follow this guide to generate your app hash.
SMS OTP AutoRead
- Make sure that the SMS template contains your app hash. You can follow this guide to generate your app hash.
Dependency
Add the following dependency to your build.gradle
file:
Usage
To enable OTP AutoRead, use the following methods based on the type of OTP you want to auto-read:
SMS OTP AutoRead
Register for auto-reading OTPs from SMS by calling the registerSmsOtpReceiver
method:
WhatsApp ZeroTap OTP AutoRead
- WhatsApp ZeroTap OTP AutoRead works for devices with Android API level 24 (Nougat) and above.
Register for auto-reading OTPs from WhatsApp by calling the
registerWhatsAppZeroTap
method:
WhatsApp OneTap OTP AutoRead
- WhatsApp OneTap OTP AutoRead works for devices with Android API level 24 (Nougat) and above.
Register for auto-reading OTPs from WhatsApp by calling the
registerWhatsAppOneTap
method:
Additionally, ensure your activity is set to singleTop
launch mode and exported
attribute is true:
Override the onNewIntent
function to receive intent from WhatsApp for OneTap OTP AutoRead.
If you are using both SMS and WhatsApp OTP AutoRead methods, then unregister the SMS OTP receiver as well if OTP is fetched via WhatsApp.
Was this page helpful?