Mob free SMS Verification Code Android SDK call method

Source: Internet
Author: User

A very good free verification code platform, support iOS, Android, than those charged stable, easy to develop. Share to everyone, I hope you don't abuse

Official website: http://mob.com/

Official development documentation, but there are a few points to note that the official did not mention, resulting in initialization failure: Android import sdksms Android jar package error, project run up: unfortunately STOPD

The following begins the development of the Android project calling interface API

The core code comes from the official documentation: HTTP://WIKI.MOB.COM/ANDROID-%E7%9F%AD%E4%BF%A1SDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3/

To create an Android project:

Modify the Androidmanifest.xml file and add the following code (user rights) = = = The first change:

Code

<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=< Span class= "hljs-string" > "Android.permission.RECEIVE_SMS" />< uses-permission android:name= " Android.permission.GET_TASKS "/><uses-permission android: Name= "Android.permission.ACCESS_FINE_LOCATION" />              
= = = Second change:

Code

<activityandroid:name="Cn.smssdk.SMSSDKUIShell"android:configchanges= "keyboardhidden| Orientation|screensize "android:theme=" @android: Style/theme.translucent.notitlebar "android: Windowsoftinputmode="Statehidden|adjustresize"/>       

Copy the jar package to the Libs directory (note!) The official did not mention, be sure to copy the jar package and the Armeabi folder)

The correct directory should be in the following structure

Write code in Mainactivity, execute in 2 steps, load two send

Code (where Appkey and Appsecret are replaced by their own)

initializes the        cn. SMSSDK. SMSSDK//cn. SMSSDK. Getverificationcode ("Smssdk","18612121304");          
Compiling tests

Receive SMS

The message inside the "private servant" is the name of the app I developed, the previous company name will only be shown in the test phase, the online will only show your app name

About validation ...

SMS send completion can call the official authentication interface for correctness check, these are done on the mob server, we only need to know the results, call method See official documents

http://wiki.mob.com/sms-android-%E6%97%A0gui%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8/

About callbacks ...

When the above method is called, a callback function is executed to obtain the result of the interface call, as described in the official documentation

http://wiki.mob.com/sms-android-%E6%97%A0gui%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8/

About Server Authentication ...

Sometimes for security purposes, to use their own server to verify, so that the client directly bypass the authentication call our server data interface, then mob also provides a way to invoke the mob interface in the background (HTTP) To verify, the use of the method is simple, there are sample code, the document is as follows

http://wiki.mob.com/smssdk-service-verify/

Demo is not available to download, the code part of the above 2 points, and then the simple code can only be manually knocked over, to be used.

Mob free SMS Verification Code Android SDK call method

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.