The effect of SMS verification is achieved by using the SDK of aggregated data.
, the effect is as follows:
Second, based on the previous period of time the blog lost How to register!
After the registration, find the personal center to find an application to apply!
Iii. creating projects based on official documents
Official documentation Api:http://yunpan.cn/czwc6mum75yyx interview Password 9f29
(includes import operations for Project Jar)
Iv. Invoking the SDK
The first step: Create and configure project (detailed methods are described in the project configuration section);
The second step: Add the development key, the required permission and so on in the androidmanifest.
(1) Add the development key in application
<meta-data android:name="JUHE_KEY" android:value="开发人员 key" />
2) Add the required permissions
<uses-permission android:name="Android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="Android.permission.INTERNET" /> <uses-permission android:name="Android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="Android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="Android.permission.READ_FINE_LOCATION" /> <uses-permission android:name="Android.permission.READ_PHONE_STATE" /><uses-permission android:name="Android.permission.READ_CONTACTS" />
The third step is to initialize the context global variables referenced by the SDK at the time of application creation:
PackageCom.juhe.captcha;ImportCom.thinkland.sdk.util.CommonFun;ImportAndroid.app.Application;/** * Initialize * * It is best to add * * * android:name= "com.xuliugen.checkmessage.CaptchaApplication" * * * * * * * * * * * * * * * @author
Piaodangdehun * * * * Public class captchaapplication extends application { @Override Public void onCreate() {Super. OnCreate ();//Initialize the context information before using each component of the SDK. Incoming ApplicationContext //Note that the method should be implemented before setcontentview the method //must be called before each functional component of the SDK is used ///Commonfun.initialize (Getapplicationcontext (), true), so we recommend that the method be placed in the application initialization method /** * Initialization method * * @param context * @needFriends If a friend function is required */
Commonfun.initialize (Getapplicationcontext (),false); }}
First get the Smscaptcha instance:
Smscaptcha smscaptcha= smscaptcha.getinstance ();
callback method Parameters:
public void Onresult (int code, string reason, string result)
Code return code:
server:0 success; 1 error;
Local:-2 local network exception; -3 server network exception;-4 parsing error;-5 initialization exception
Reason returns the message success or error reason.
Result returns the results in JSON format. Empty when error or no return value.
V. Project source code:
Http://yunpan.cn/cZwcDLm8TiNRm Interview Password c502
Android manual SMS Verification code function