Android SMS Verification mobsms Integration

Source: Internet
Author: User

Concepts and principles

About Mobsms

Main API

Initializing interfaces

SMS Authentication Interface

SMS Verification Callback

Code section

mobsms to add to the project:

S1. Download the official SDK file link;

S2. Adding and configuring the SDK library files:

Add Aar/jar file to \app\libs project directory

Configure Build.gradle

repositories{

flatdir{

Dirs ' libs '//Smssdk-2.1.4.aar/smssdkgui-2.1.4.aar file directory

}

}

dependencies {

Compile Filetree (include: [' *.jar '], dir: ' Libs ')

Compile name: ' SMSSDK-2.1.4 ', ext: ' AAR '

Compile name: ' SMSSDKGUI-2.1.4 ', ext: ' AAR '

Compile files (' Libs/mobtools-2017.0321.1624.jar ')

Compile files (' Libs/mobcommons-2017.0321.1624.jar ')

}

S3. Configuring the Manifest.xml file:

<uses-permission android:name= "Android.permission.READ_CONTACTS"/>

<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>

<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-permission android:name= "Android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name= "Android.permission.ACCESS_WIFI_STATE"/>

<uses-permission android:name= "Android.permission.INTERNET"/>

<uses-permission android:name= "Android.permission.RECEIVE_SMS"/>

<uses-permission android:name= "Android.permission.READ_SMS"/>

<uses-permission android:name= "Android.permission.GET_TASKS"/>

<uses-permission android:name= "Android.permission.ACCESS_FINE_LOCATION"/>

<activity

Android:name= "Com.mob.tools.MobUIShell"

Android:theme= "@android: Style/theme.translucent.notitlebar"

Android:configchanges= "Keyboardhidden|orientation|screensize"

Android:windowsoftinputmode= "Statehidden|adjustresize"/>

S4. Get Appkey/appsecret:

Http://dashboard.mob.com/#/sms/index

Apps = Add Apps + Android + add

Call Mobsms SMS Service:

Mobsms SDK Initialization smssdk.initsdk (this, "Your Appkey", "Your Appsecret");//Get Verification Code Smssdk.getverificationcode ("", PhoneNumber , null);//Submit Verification Code Smssdk.submitverificationcode ("Phonenumber,verifycode");//SMS verification callback EventHandler EH = new Eventhandle R () {@Override public void afterevent (int event, int result, Object data) {if (result = = Smssdk . Result_complete) {//callback complete if (event = = Smssdk.                Event_submit_verification_code) {//Submit Verification Code Success LOG.I ("EventHandler", "Submit verification Code Success"); } else if (event = = Smssdk.                Event_get_verification_code) {//Get Verification code into LOG.I ("EventHandler", "Get Verification Code success"); } else if (event = = Smssdk. Event_get_supported_countries) {//Returns a list of countries that support the sending of a verification code log.i ("EventHandler", "return to the country that supports sending the verification code                Home List ");                }} else {((throwable) data). Printstacktrace (); Runonuithread (New Runnable () {@Override public void run () {Infotext.settext (                    "SMS verification Failed");                }                });            LOG.I ("EventHandler", "Callback failed"); }        }    };

  

Reference Documentation:

Mobsms Download SDK

GitHub Project

Official SDK Integration Documentation Reference

No GUI interface overview

Android SMS SDK Action callback

Android SMS Verification mobsms Integration

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.