Android manual 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, 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

Related Article

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.