本文整理汇总了Java中cn.smssdk.SMSSDK.getVerificationCode方法的典型用法代码示例。如果您正苦于以下问题:Java SMSSDK.getVerificationCode方法的具体用法?Java SMSSDK.getVerificationCode怎么用?Java SMSSDK.getVerificationCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.smssdk.SMSSDK
的用法示例。
在下文中一共展示了SMSSDK.getVerificationCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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);
}
}
示例3: 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);
}
示例4: 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;
}
}
示例5: sendRequest
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
/**
* 发送验证码请求
*/
public static boolean sendRequest(String phone) {
if (!isReady)
return false;
if (!XSCHelper.getInstance().connect()) {
Toast.makeText(context, "当前喵网络链接", Toast.LENGTH_SHORT).show();
return false;
}
if (System.currentTimeMillis() - registTime >= 60000) {
registTime = System.currentTimeMillis();
SMSSDK.getVerificationCode(CHINA, phone);
return true;
} else {
Toast.makeText(context, "请求验证码间隔少于60喵,请原地喵", Toast.LENGTH_SHORT).show();
return false;
}
}
示例6: getCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
/**
* 获取验证码
*/
private void getCode() {
mPhone = mEtPhone.getText().toString().trim().replace("\\s*", "");
// String countryCode = mTvCountryCode.getText().toString().trim();
String countryCode = "+86";
// String countryCode = mTvCountryCode.getText().toString().trim();
if (checkPhoneNum(mPhone, countryCode)) {
/*请求获得验证码*/
Log.d(TAG, "getCode: " + mPhone + "**" + countryCode);
SMSSDK.getVerificationCode(countryCode, mPhone);
mCountTimeView = new CountTimerView(mGetCode);
mCountTimeView.start();
mDialog.show();
}
}
示例7: getCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
/**
* 获取短信验证码
*/
private void getCode() {
// 通过规则判断手机号
if (!judgePhoneNums(phone)) {
return;
}
SMSSDK.getVerificationCode("86", phone);
tv_getcode.setText("重新发送(" + i + ")");
new Thread(new Runnable() {
@Override
public void run() {
for (; i >= 0; i--) {
h.sendEmptyMessage(1);
if (i == 0) {
break;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
示例8: reSendCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
@OnClick(R.id.btn_reSend)
public void reSendCode(View view){
SMSSDK.getVerificationCode("+"+countryCode, phone);
countTimerView = new CountTimerView(mBtnResend,R.string.smssdk_resend_identify_code);
countTimerView.start();
dialog.setMessage("正在重新获取验证码");
dialog.show();
}
示例9: reSendCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
/**
* 重新发送验证码
*/
public void reSendCode() {
SMSSDK.getVerificationCode("+" + countryCode, phone);
countTimerView = new CountTimerView(mBtnReSend, R.string.smssdk_resend_identify_code);
countTimerView.start();
}
示例10: getCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
/**
* 获取到国家编码
*/
private void getCode() {
String phone = mEtPhone.getText().toString().trim().replaceAll("\\s*", "");
String code = mTxtCountryCode.getText().toString().trim();
String pwd = mEtPassword.getText().toString().trim();
if (checkPhoneNum(phone, code)) {
//not 86 +86
SMSSDK.getVerificationCode(code, phone);
}
}
示例11: onClick
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
public void onClick(View v)
{
String phoneNums = inputPhoneEt.getText().toString();
if(v.getId() == R.id.login_request_code_btn)
{
SMSSDK.getVerificationCode("86", phoneNums);
requestCodeBtn.setClickable(false);
requestCodeBtn.setText("重新发送(" + i + ")");
new Thread(new Runnable()
{
public void run()
{
for(; i>0; i--)
{
handler.sendEmptyMessage(-9);
if(i<=0)
{
break;
}
try
{
Thread.sleep(1000);
}catch(Exception e)
{
e.printStackTrace();
}
}
handler.sendEmptyMessage(-8);
}
}).start();
}
else if(v.getId() == R.id.login_commit_btn)
{
SMSSDK.submitVerificationCode("86", phoneNums, inputCodeEt.getText().toString());
}
}
示例12: onClick
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button1://获取验证码
if (!TextUtils.isEmpty(phonEditText.getText().toString())) {
SMSSDK.getVerificationCode("86", phonEditText.getText().toString());
phString = phonEditText.getText().toString();
} else {
Toast.makeText(this, "电话不能为空", Toast.LENGTH_SHORT).show();
}
break;
case R.id.button2://校验验证码
if (!TextUtils.isEmpty(verEditText.getText().toString())) {
SMSSDK.submitVerificationCode("86", phString, verEditText.getText().toString());
} else {
Toast.makeText(this, "验证码不能为空", Toast.LENGTH_SHORT).show();
}
break;
case R.id.button3://国家列表
SMSSDK.getSupportedCountries();
//SMSSDK.getCountry("86");
break;
default:
break;
}
}
示例13: getVerCode
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
public static void getVerCode(String disCode, String phoneNum) {
SMSSDK.getVerificationCode(disCode, phoneNum);
}
示例14: onClick
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.register:
String strCode = mEditTextCode.getText().toString();
if (strCode != null && strCode.length() == 4) {
Log.d(TAG, mEditTextCode.getText().toString());
SMSSDK.submitVerificationCode("86", strPhoneNumber, mEditTextCode.getText().toString());
} else {
Toast.makeText(getApplicationContext(), "验证码长度不正确", Toast.LENGTH_SHORT).show();
}
break;
case R.id.get_code:
strPhoneNumber = mEditTextPhoneNumber.getText().toString();
if (strPhoneNumber == null || "".equals(strPhoneNumber) || strPhoneNumber.length() != 11) {
Toast.makeText(getApplicationContext(), "电话号码输入有误", Toast.LENGTH_SHORT).show();
}
codeStr = et.getText().toString().trim();
if (null == codeStr || TextUtils.isEmpty(codeStr)) {
Toast.makeText(getApplicationContext(), "请输入图形验证码", Toast.LENGTH_SHORT).show();
return;
}
String code = codeUtils.getCode();
if (code.equalsIgnoreCase(codeStr)) {
SMSSDK.getVerificationCode("86", strPhoneNumber);
mButtonGetCode.setClickable(false);
//开启线程去更新button的text
new Thread() {
@Override
public void run() {
int totalTime = 60;
for (int i = 0; i < totalTime; i++) {
Message message = myHandler.obtainMessage(0x01);
message.arg1 = totalTime - i;
myHandler.sendMessage(message);
try {
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
myHandler.sendEmptyMessage(0x02);
}
}.start();
mLayout_send.setVisibility(View.VISIBLE);
} else {
Toast.makeText(getApplicationContext(), "验证码错误", Toast.LENGTH_SHORT).show();
}
break;
case R.id.btn:
codeUtils = CodeUtils.getInstance();
Bitmap bitmap = codeUtils.createBitmap();
image.setImageBitmap(bitmap);
break;
}
}
示例15: sendCaptcha
import cn.smssdk.SMSSDK; //导入方法依赖的package包/类
public static void sendCaptcha(String country, String phone) {
SMSSDK.getVerificationCode(country, phone);
}