Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
All of us have seen a plenty of applications that use OTP for login process but pretty much of them access your message and fill the OTP in its place by itself and we just loved it because it saves our work and time. We don’t have to put our application in background and then note the OTP and come back or even go to notification bar to know the OTP. So basically this feature is quiet interesting. Today I will show you how you can implement this in your android application.
Firstly and for mostly we have to create a BroadcastReceiver which will process the message for us. So lets create a receiver named ReceiveMessage
As you can see onReceive we have extracted the message, you can add regular expressions to get the exact code your server is sending, and instantialtied our activity to call a method onRecieveOPT(String). So we are implementing our Activity and this method in it.
So we declared our activity as well as method. You can see here I had put the whole text as it is in EditText. But as I said you can apply a regular expression to extract only code. Also be sure to mention your receiver in manifest file with proper permissions.
And you are ready to receive your OTP directly in your application.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.