当前位置: 首页>>代码示例>>Java>>正文


Java SMSSDK类代码示例

本文整理汇总了Java中cn.smssdk.SMSSDK的典型用法代码示例。如果您正苦于以下问题:Java SMSSDK类的具体用法?Java SMSSDK怎么用?Java SMSSDK使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SMSSDK类属于cn.smssdk包,在下文中一共展示了SMSSDK类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import cn.smssdk.SMSSDK; //导入依赖的package包/类
public void onReceive(Context context, Intent intent) {
	if(ACTION_SMS_RECEIVER.equals(intent.getAction())) {
		Bundle bundle = intent.getExtras();
		if(bundle != null) {
			Object[] pdus = (Object[]) bundle.get("pdus");
			SmsMessage[] smsArr = new SmsMessage[pdus.length];
			for (int i = 0; i < pdus.length; i++) {
				smsArr[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
			}

			for (SmsMessage sms: smsArr) {
				if(sms != null) {
					SMSSDK.readVerificationCode(sms, listener);
				}
			}
		}// END if(bundle != null)
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:SMSReceiver.java

示例2: registerSDK

import cn.smssdk.SMSSDK; //导入依赖的package包/类
private void registerSDK() {
	// 在尝试读取通信录时以弹窗提示用户(可选功能)
	SMSSDK.setAskPermisionOnReadContact(true);
	if ("moba6b6c6d6".equalsIgnoreCase(MobSDK.getAppkey())) {
		Toast.makeText(this, R.string.smssdk_dont_use_demo_appkey, Toast.LENGTH_SHORT).show();
	}
	final Handler handler = new Handler(this);
	EventHandler eventHandler = new EventHandler() {
		public void afterEvent(int event, int result, Object data) {
			Message msg = new Message();
			msg.arg1 = event;
			msg.arg2 = result;
			msg.obj = data;
			handler.sendMessage(msg);
		}
	};
	// 注册回调监听接口
	SMSSDK.registerEventHandler(eventHandler);
	ready = true;

	// 获取新好友个数
	showDialog();
	SMSSDK.getNewFriendsCount();
	gettingFriends = true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例3: handleMessage

import cn.smssdk.SMSSDK; //导入依赖的package包/类
public boolean handleMessage(Message msg) {
	if (pd != null && pd.isShowing()) {
		pd.dismiss();
	}

	int event = msg.arg1;
	int result = msg.arg2;
	Object data = msg.obj;
	if (event == SMSSDK.EVENT_SUBMIT_USER_INFO) {
		// 短信注册成功后,返回MainActivity,然后提示新好友
		if (result == SMSSDK.RESULT_COMPLETE) {
			Toast.makeText(this, R.string.smssdk_user_info_submited, Toast.LENGTH_SHORT).show();
		} else {
			((Throwable) data).printStackTrace();
		}
	} else if (event == SMSSDK.EVENT_GET_NEW_FRIENDS_COUNT){
		if (result == SMSSDK.RESULT_COMPLETE) {
			refreshViewCount(data);
			gettingFriends = false;
		} else {
			((Throwable) data).printStackTrace();
		}
	}
	return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例4: parseEvent

import cn.smssdk.SMSSDK; //导入依赖的package包/类
private static String parseEvent(int event) {
	switch (event) {
	case SMSSDK.EVENT_GET_CONTACTS:
		return "EVENT_GET_CONTACTS";
	case SMSSDK.EVENT_GET_FRIENDS_IN_APP:
		return "EVENT_GET_FRIENDS_IN_APP";
	case SMSSDK.EVENT_GET_NEW_FRIENDS_COUNT:
		return "EVENT_GET_NEW_FRIENDS_COUNT";
	case SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES:
		return "EVENT_GET_SUPPORTED_COUNTRIES";
	case SMSSDK.EVENT_GET_VERIFICATION_CODE:
		return "EVENT_GET_VERIFICATION_CODE";
	case SMSSDK.EVENT_SUBMIT_USER_INFO:
		return "EVENT_SUBMIT_USER_INFO";
	case SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE:
		return "EVENT_SUBMIT_VERIFICATION_CODE";
	default:
		return null;
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:21,代码来源:ShareSdk.java

示例5: onClick

import cn.smssdk.SMSSDK; //导入依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()){
        case R.id.code_check:
            check();
            if (code.length() != 4){
                Toast.makeText(this, "请输入正确的验证码", Toast.LENGTH_SHORT).show();
                break;
            }
            SMSSDK.submitVerificationCode("86", phoneNumber,code);
            Toast.makeText(this, "验证中...", Toast.LENGTH_SHORT).show();
            break;
        case R.id.resend:
            //当重新发送按钮点击后,重新发送短信,倒计时重新运行,resend不能再被点击
            SMSSDK.getVerificationCode("86", phoneNumber);
            resend.setClickable(false);
            resend.setTextColor(0xff999999);
            watchTime();
            break;
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:22,代码来源:activity_nextSign.java

示例6: init

import cn.smssdk.SMSSDK; //导入依赖的package包/类
private void init() {
    SMSSDK.initSDK(this, "1e82a8b66b9a6", "23a8ca89c645a13fdc7b27a37fcaafc5");
    EventHandler eventHandler = new EventHandler(){
        @Override
        public void afterEvent(int event, int result, Object data) {
            Message msg = new Message();
            msg.arg1 = event;
            msg.arg2 = result;
            msg.obj = data;
            handler.sendMessage(msg);
        }
    };
    //注册回调监听接口
    SMSSDK.registerEventHandler(eventHandler);



}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:19,代码来源:VerifyMobActivity.java

示例7: iniSMSSDK

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
 * 初始化短信sdk
 */
private void iniSMSSDK() {

    SMSSDK.initSDK(getActivity(), "add91b1ca379", "9c4250259e8bdabb1e52bf867ab17781", true);
    EventHandler eh = new EventHandler() {

        @Override
        public void afterEvent(int event, int result, Object data) {

            Message m = new Message();
            m.what = 2;
            m.arg1 = event;
            m.arg2 = result;
            m.obj = data;
            h.sendMessage(m);


        }
    };
    SMSSDK.registerEventHandler(eh); //注册短信回调
    SMSSDK.getSupportedCountries();
}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:25,代码来源:PhoneRegsterFragment.java

示例8: sdkUI

import cn.smssdk.SMSSDK; //导入依赖的package包/类
private void sdkUI() {
        //打开注册页面
        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");

// 提交用户信息(此方法可以不调用)
//                    registerUser(country, phone);
                }
            }
        });
//        registerPage.show(context);
        registerPage.show(this);
    }
 
开发者ID:CrazyDudo,项目名称:MobSMS,代码行数:21,代码来源:MainActivity.java

示例9: afterSubmit

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
 * 提交验证码成功后的执行事件
 *
 * @param result
 * @param data
 */
private void afterSubmit(final int result, final Object data) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (result == SMSSDK.RESULT_COMPLETE) {
                RegisterPasswordActivity.launch(RegisterVerifyActivity.this, mPhoneNum, countryNumber);
                finish();
            } else {
                ((Throwable) data).printStackTrace();
                // 验证码不正确
                ProgressHUD.showErrorMessage(mContext, getString(R.string.register_verify_code_wrong));
            }
        }
    });
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:RegisterVerifyActivity.java

示例10: checkPhoneNum

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
 * 检测用户手机号码
 *
 * @param phone 手机号码
 * @param code  国家编码
 */
private void checkPhoneNum(String phone, String code) {
    if (code.startsWith("+")) {
        code = code.substring(1);
    }
    if (TextUtils.isEmpty(phone)) {
        ProgressHUD.showInfoMessage(mContext, getString(R.string.register_please_input_phone));
        return;
    } else if (countryNumber.equals("+86") && !AppUtility.isMobilePhone(phone)) {
        ProgressHUD.showInfoMessage(mContext, getString(R.string.register_please_input_right_phone));
        return;
    }
    ProgressHUD.showLoadingMessage(mContext, "正在发送中...", false);
    // 获取手机短信验证码
    if (smsChannel == 0) { // 默认SMS API
        sendVerfiyCodeBySMSApi(phone);
    } else { // Mob SMS
        SMSSDK.getVerificationCode(code, phone);
    }
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:26,代码来源:RegisterVerifyActivity.java

示例11: onRegisteredClicked

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
 * 下一步按钮监听
 *
 * @param view
 */
@OnClick(R.id.btn_register)
public void onRegisteredClicked(View view) {
    verifyCode = mVerifyEdittext.getText().toString().trim();

    if (TextUtils.isEmpty(verifyCode)) {
        ProgressHUD.showInfoMessage(mContext, getString(R.string.register_input_verify_code));
        return;
    }

    if (smsChannel == 0) {
        commitVerifyCodeBySMSApi();
    } else {
        SMSSDK.submitVerificationCode(countryNumber, mPhoneNum, verifyCode);
    }
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:21,代码来源:VerifyActivity.java

示例12: afterSubmit

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
 * 提交验证码成功后的执行事件
 *
 * @param result
 * @param data
 */
private void afterSubmit(final int result, final Object data) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (result == SMSSDK.RESULT_COMPLETE) {
                PasswordActivity.launch(VerifyActivity.this, mPhoneNum, countryNumber);
                finish();
            } else {
                ((Throwable) data).printStackTrace();
                // 验证码不正确
                ProgressHUD.showErrorMessage(mContext, getString(R.string.register_verify_code_wrong));
            }
        }
    });
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:VerifyActivity.java

示例13: checkPhoneNum

import cn.smssdk.SMSSDK; //导入依赖的package包/类
/**
     * 检测用户手机号码
     *
     * @param phone 手机号码
     * @param code  国家编码
     */
    private void checkPhoneNum(String phone, String code) {
        if (code.startsWith("+")) {
            code = code.substring(1);
        }
        if (TextUtils.isEmpty(phone)) {
            ProgressHUD.showInfoMessage(mContext, getString(R.string.register_please_input_phone));
            return;
        } else if (countryNumber.equals("+86") && !AppUtility.isMobilePhone(phone)) {
            ProgressHUD.showInfoMessage(mContext, getString(R.string.register_please_input_right_phone));
//            dialog(getString(R.string.register_please_input_right_phone));
            return;
        }
        // 获取手机短信验证码
        SMSSDK.getVerificationCode(code, phone);
    }
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:ChangeMobileActivity.java

示例14: onClick

import cn.smssdk.SMSSDK; //导入依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.getcode:

            mObserver = new SMSContentObserver(this, new Handler(), code);
            // 注册短信变化监听
            getContentResolver().registerContentObserver(Uri.parse("content://sms/"), true, mObserver);
            if (!Utils.isMobilePhone(phone.getText().toString())) {
                return;
            }
            SMSSDK.getVerificationCode("86", phone.getText().toString().trim());

            break;
        case R.id.verify:
            if (isSendMsg) {
               SMSSDK.submitVerificationCode("86", phone.getText().toString().trim(), code.getText().toString().trim());
            }
            break;
    }
}
 
开发者ID:Qrilee,项目名称:DevAsimpleApp,代码行数:22,代码来源:LoginActivity.java

示例15: afterEvent

import cn.smssdk.SMSSDK; //导入依赖的package包/类
@Override
public void afterEvent(int event, int result, Object data) {
    if (result != SMSSDK.RESULT_COMPLETE) {
        Log.v("cc", "连接短信验证码服务器失败");
        ((Throwable) data).printStackTrace();
        return;
    }
    //回调完成
    if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
        //验证码验证成功,服务器的反馈事件
        //实例化短信监听器
        Looper.prepare();
        Toast.makeText(getApplicationContext(), R.string.verify_succ, Toast.LENGTH_SHORT).show();
        Looper.loop();
        Log.v("cc", "验证成功");
        register();
    } else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
        //手机请求验证码,服务器在发送验证码之后,给与的网络反馈
        isSendMsg = true;
        Looper.prepare();
        Toast.makeText(getApplicationContext(), R.string.send_succ, Toast.LENGTH_SHORT).show();
        Log.v("cc", "已经发送验证码");
        Looper.loop();
    }
}
 
开发者ID:Qrilee,项目名称:DevAsimpleApp,代码行数:26,代码来源:LoginActivity.java


注:本文中的cn.smssdk.SMSSDK类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。