Auto OTP Read - React Native (Android)
In this article, I want to demonstrate how to retrieve an OTP from an incoming message on Android. As we know, on iOS, the OTP from the incoming message is automatically displayed above the keyboard.
To retrieve the OTP we will take help of a third party library react-native-otp-verify . Please follow the installation instruction. After the setup have been completed we need to confirm the message template. To auto verify there is a a pattern of the message.
Your verification code is 793903 XYZ Limited <hashcode>
We can get the hashcode from react-native-otp-verify library by the getHash() method. The returned hsashcode this method need to append in the message template. Let us assume the returned hashcode from getHash() is QSGtob4Qmy5. The hashcode will be unique for a specific bundle identifier.
Example Message
Your XYZ-Company OTP verification code is 793903 XYZ-Company LIMITED QSGtob4Qmy5
Assuming OTP length is 6.
Full Stack Developer with a focus on React & Node Building user-friendly web applications.
7 个月It's a great insight ??