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
How to achieve marketing demands through corporat...
It is really not easy to be a celebrity nowadays....
There are two topics today. The first one is &quo...
In our daily work, we have all read a lot of usef...
Not only Tesla owned by "Iron Man" Musk...
The emergence of mini programs has simplified the...
Special reminder: This article is a long technica...
H5 is gaining popularity, which always reminds pe...
If you were to ask: Which brands do you think hav...
Tik Tok is the most popular trendy short video so...
In the new round of cooperation in the field of s...
At 9:00 a.m. on May 30, the Shenzhou 16 manned sp...
Yu Minhong’s New Oriental has recently gotten int...
In the kitchen or restaurant, you can always hear...
[[149904]] Steve Jobs' iPhone is a work of ar...