I believe that many friends will add the function of SMS verification when doing three-party login. Recently, I was assigned to realize this requirement. I am a novice and searched for information on the Internet. Currently, the more commonly used ones are Dahan.Cloud Communication and MOB's SMSsdk. After comparison, I finally chose the completely free MOB product to try my hand. The following are some of my experiences in the process of using the SDK. I hope that the masters who see it can give some suggestions. If you like it, just give a little heart. First, I searched on Baidu for Mob's official website (http://www.mob.com/). As a first-time user, I opened the document introduction first. The introduction here is quite detailed about the usage, so I won't go into details here. I browsed the entire document and found that there are two methods, one is maven integration of AS, and the other is ordinary integration of Eclipse. The company's project is AS, so the latter is not considered. The maven integration method is really suitable for novices. It only needs to be configured in gradle, which saves time and effort. Here is the code first: Add the following script to your root module build.gradle:
//The appkey and appsecret here are obtained when creating an application in the mob background, so when you need to use it, go to the official website to register an account and enter the background to create After configuring the above gradle configuration, the smssdk is basically integrated. The calling code is provided in the document. I copied and pasted it directly into my demo and tested it. It was unexpectedly smooth, but the only dissatisfaction is that this SMS verification interface is too old-fashioned. The product will definitely not pass it (put away the lazy thoughts). I silently studied the document again and saw a GUI-free usage method (http://wiki.mob.com/sms-android-%E6%97%A0gui%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8/). They provide relevant interfaces. I will not post the specific pictures. You can go to the official website document to see it. It should be noted that if it is your own UI, you need to add it in the place where the gradle configuration of smssdk was previously configured.
Because it's just a demo test, the UI layout is written casually, just to meet normal testing, it's a bit ugly The following is the call to write the interface code. The document provides an initialization interface. RegisterEventHandler is used to register an event receiver in SMSSDK. SMSSDK allows developers to register any number of receivers. All receivers will receive messages when the event is triggered. The following is part of my code:
The following is a simple call to the send verification interface:
The code is actually quite simple. The most important thing about the test is the verification efficiency. I personally feel it is quite fast. It is basically received within two or three seconds after sending. More importantly, it is free. It is still worth recommending. Having said so much, let’s take a look at the effect picture: Supplementary explanation of a pit: This is where you can add SMS product settings in the mob backend. I accidentally clicked it, which resulted in me not receiving any SMS messages. I had to ask the technical customer service for a long time before I found out. Please be careful when clicking. The writing is rather crude, I hope it will be helpful to students in need =. = |
<<: Roll up your sleeves and write an Android universal refresh control
>>: All the fun and useful apps from the App Store in the past ten years are here
A beautiful appearance but a boring soul can only...
The huge logo of Apple's Fifth Avenue flagshi...
The blind box craze has made Pop Mart popular, ma...
Zhuhai Yinlong recently launched a panda-shaped b...
This article was reviewed by Tao Ning, PhD, Assoc...
For the video industry, the model of spending mon...
Produced by: Science Popularization China Author:...
Smartphones have become a necessity in daily life...
Seizing the opportunity of the rise of domestic t...
Haikou Machinery Equipment Mini Program investmen...
In operational work, there is a position that req...
Mixed Knowledge Specially designed to cure confus...
[This issue's rumor] Recently, a self-media a...
The 2016 Spring Festival is coming. How can a sma...
This is a good sign for 2016. What apps do you us...