Android Registration SMS Verification code function

Source: Internet
Author: User

The effect of SMS verification is achieved by using the SDK of aggregated data.
, the effect is as follows:


Second, according to the previous period of time the blog lost How to register! After registering to find the personal center to find application for an application can!

Iii. creating projects based on official documents
Official document API:HTTP://YUNPAN.CN/CZWC6MUM75YYX access password 9f29
(Contains the import operation for the project Jar)

Iv. Invoking the SDK

The first step: Create and configure the project (see the Project configuration section for details);
The second step: Add the development key, the required permission and other information in the androidmanifest;
(1) Add a 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 include * * android:name= "com.xuliugen.checkmessage.CaptchaApplication" * * * * * * * * in the application tag @author Piaodangdehun * * * * Public  class captchaapplication extends application {    @Override     Public void onCreate() {Super. OnCreate ();//Initialize the context information before using each component of the SDK and pass in the ApplicationContext        //Note that the method should be implemented before setcontentview the method        //need to 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        /** * Initialize Method * * @param context * @needFriends If you need a friend feature */
     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 successes; 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 Access Password c502

Android Registration SMS Verification code function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.