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