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?

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
PKHunter
  • 682
  • 2
  • 13
  • 28

2 Answers2

1

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

Community
  • 1
  • 1
Deepak Negi
  • 893
  • 10
  • 19
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.

VegeOSplash
  • 214
  • 1
  • 3
  • 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. – PKHunter Aug 02 '14 at 02:08