Android uses mobsdk SMS authentication
SMS registration and SMS verification are already commonplace, so of course you should learn how to use the SDK. Mobsdk can send SMS for free, of course you can use it http://www.mob.com
1. First download the SDK
2. Create a new folder called Lib in the project and put four things in it
3. In the build. Of app Gradule adds the following code
4. On Android manifest Add permissions and activities to XML
Add under application
5. Start using
Initialize SDK
SMSSDK. Initsdk (this, "your appkey", "your appsecret");
Send verification code
SMSSDK. Getverificationcode ("86", "your mobile phone number");
6. Verification code
After receiving the verification code, you should post it to the mob server for verification. First, open the server verification switch on the official website
The request address is: https://webapi.sms.mob.com/sms/verify
Request method: Post
Request parameters • appkey application • appkey • phone number • zone code • code verification code to be verified
I have written the method content of post for you. You can return the result by passing the address and parameters
Since it is a network request, of course, a new thread should be created
Output result example {status: 200} result code
Return value result description 200 verification succeeded 405 appkey is empty 406 appkey is invalid 456 country code or mobile phone number is empty 457 mobile phone number format error 466 verification code requested for verification is empty 467 verification code requested frequently (the same number of the same appkey can only be verified three times within 5 minutes) 468 verification code error 474 server verification switch is not turned on
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.