Ankur Jain
Ankur Jain

Reputation: 164

Handling SMS permissions on android for auto verifying OTP

I am developing an android app, in which i require user to verify himself for the first time using sms based verification. In this user gives me his mobile number and i send him an OTP, which he can enter and verifies himself.

As soon as user enters the mobile, i read his SMS and on getting the desired SMS i extract OTP and automatically verify him. Now in order to do in newer android permissions model, i have to ask to user to give me SMS permissions. So i have following two part questing.

1) When should i ask for those permissions. For ex: if i ask him after he enters his mobile number, then let's say user accepts the permissions after the sms came, then it is of no use. If i ask him upfront when he comes to my app he might not understand the context why i need that permission.

2) Should i really auto verify the user or the better UX is to stay away from asking SMS permissions and let the user enter his OTP manually ?

Upvotes: 1

Views: 858

Answers (2)

Vipin Sharma
Vipin Sharma

Reputation: 704

When user enter mobile number and tap on submit button then ask him for permission and after user selection, request server for OTP (inside onRequestPermissionResult).

Upvotes: 0

user4035628
user4035628

Reputation:

You can ask for permission when User reaches SMS screen and then:

  1. If he accepts, read text and Auto verify.
  2. If rejects, prompt him to Enter it manually.

Hope it helps!

Upvotes: 2

Related Questions