Mobile app: how to show the OTP my app sends in a popup without leaving my app?
Asked Answered
D

2

7

We've had to code an OTP based authentication. I have seen some apps, like my bank's app, which when it sends the OTP also then immediately does a quick popup of the SMS that has just arrived, so I can see the OTP without leaving the app. I just memorize the number, close the popup, and get on with the login inside that app.

How do they do that? Is there some iOS/Android spec I should be looking at, which allows us to similarly popup the OTP without the user having to go to the SMS screen, then come back to our app? Thanks!

EDIT: I have very useful Android suggestions. Now looking for iOS variations of these recommendations. Understand iOS has much more stringent sandboxing limitations, so the "listener" may be more complex?

Dressmaker answered 30/7, 2014 at 10:14 Comment(2)
You need to register SMS listener in your application that are received in the android phone..Newsdealer
you need to use broadcast receiver for that and you can do it through this conceptOva
J
1

For android you need to use SMSListener as pointed out by @rushabh. You can check at a great example here

Jempty answered 30/7, 2014 at 11:4 Comment(0)
N
1

Some Tips to achieve your mention task for your App.
Step - 1 create a Login Activity with necessary field like username , password and otp and Login Button.

Step - 2 When user fill the username and password make a web service call. with input params (username and password) authenticate the values if true means send your OTP number as response else response error message.

Step -3 if response is number means create AlertBuilder for Pop window to show your OTP number in same Activity.

Step - 4 user saw the OTP in Login Activity itself and enters the OTP in opt area i.e (EditText).

Step - 5 When user tap the login Button authenticate the OTP value. and proceed to next Activity.

Nazario answered 30/7, 2014 at 11:9 Comment(1)
Good pseudocode. Just checking between step 2 and 3 -- the OTP can only be send as a response number to a mobile number, NOT the web service instance. As in, it won't use the web protocol to send something like a message. It needs to use the telephony protocol. All I need to do is to make sure my app has a "listener" that listens to the SMSes received from a number that belongs to me so my app can pick up the content (OTP number) and popup.Dressmaker

© 2022 - 2024 — McMap. All rights reserved.