First, register the mob account and login to the official website http://www.mob.com/#/
Account:[email protected] password:tmy2016
Second, enter the SMS registration background URL:http://dashboard.mob.com/#/sms/index
Add an App
Generate app Information
Third, download the SMS Verification SDK address:http://www.mob.com/#/downloadDetail/SMS/android
The extracted files are
Iv. Import
Set up a library project project separately
Right-click to select properties-->android - check is library-->apply-->ok
V. New Project
Right-click to select properties-->android-->add-->ok-->apply-->ok
Code implementation:1>moocactivity.java
public class Moocactivity extends Activity {
Button Mbtnbindphone;
String appkey= "15864f2b39d2e";
String appsecrete= "05C7ACF81F9BC63331EC8244F5826ADC";
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.LAYOUT.ACTIVITY_MOOC);
Initialize
SMSSDK.INITSDK (This, APPKEY, appsecrete);
configuration information androidmanifest.xml
Mbtnbindphone= (Button) Findviewbyid (R.id.btn_bind_phone);
Mbtnbindphone.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View arg0) {
Register Phone number
Registerpage registerpage=new registerpage ();
Registering callback Events
Registerpage.setregistercallback (New EventHandler () {
called when the event completes
@Override
public void Afterevent (int event, int result, Object data) {
determine if the structure is complete
if (RESULT==SMSSDK. Result_complete) {
data access
Hashmap<string, object> maps= (hashmap<string, object>) data;
National
String country= (String) maps.get ("Country");
Phone number
String phone= (String) maps.get ("Phone");
Submituserinfo (country, phone);
Toast.maketext (Moocactivity.this, "Phone:" +phone+ "Country:" +country, Toast.length_short). Show ();
}
Super.afterevent (arg0, arg1, arg2);
}
});
Show Registration Page
Registerpage.show (Moocactivity.this);
}
});
}
/*
* Submit User Information
* */
public void Submituserinfo (String country,string phone) {
Random r=new random ();
String Uid=math.abs (R.nextint ()) + "";
String nickname= "Tmy";
Smssdk.submituserinfo (UID, nickname, NULL, country, phone);
}
}
2>activity_mooc.xml:
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Vertical" >
<button
Android:id= "@+id/btn_bind_phone"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
android:text= " Register or bind mobile phone number "/>
</LinearLayout>
3>androidmanifest.xml
Add the following code <!-- configured Network permissions--
<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"/>
Okay, run.
Android Integrated SMS Verification