短信验证

来源:互联网 发布:java管理系统界面 编辑:程序博客网 时间:2024/04/16 05:22
apply plugin: 'com.android.application'android {    compileSdkVersion 25    buildToolsVersion "25.0.2"    defaultConfig {        applicationId "fengras.com.duanxinfasong"        minSdkVersion 15        targetSdkVersion 25        versionCode 1        versionName "1.0"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }    sourceSets{        main{            jni.srcDirs=['src/main/jni','src/main/jniLibs']            res.srcDirs=['src/main/res','src/main/res/layout']        }    }}repositories{    flatDir{        dirs 'libs'    }}dependencies {    compile fileTree(include: ['*.jar'], dir: 'libs')    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:25.3.1'    compile files('libs/MobTools-2016.1201.1839.jar')    compile files('libs/MobCommons-2016.1201.1839.jar')    compile name:'SMSSDK-2.1.3',ext:'aar'    compile name:'SMSSDKGUI-2.1.3',ext:'aar'}










MyApp

package fengras.com.duanxinfasong;import android.app.Application;import cn.smssdk.SMSSDK;/** * Created by Administrator on 2017/3/23. */public class MyApp extends Application{    @Override    public void onCreate() {        super.onCreate();        SMSSDK.initSDK(this, "1c5e4d3ab3fe2", "38cb747163a1bc20372be8e8cfb34f0e");    }}







package fengras.com.duanxinfasong;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import java.util.HashMap;import cn.smssdk.EventHandler;import cn.smssdk.SMSSDK;import cn.smssdk.gui.RegisterPage;public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        setContentView(R.layout.activity_main);        //打开注册页面        RegisterPage registerPage = new RegisterPage();        registerPage.setRegisterCallback(new EventHandler() {            public void afterEvent(int event, int result, Object data) {// 解析注册结果                if (result == SMSSDK.RESULT_COMPLETE) {                    @SuppressWarnings("unchecked")                    HashMap<String,Object> phoneMap = (HashMap<String, Object>) data;                    String country = (String) phoneMap.get("country");                    String phone = (String) phoneMap.get("phone");// 提交用户信息(此方法可以不调用)                }            }        });        registerPage.show(this);    }}

0 0
原创粉丝点击