本文整理汇总了Java中cn.smssdk.SMSSDK.EVENT_GET_VERIFICATION_CODE属性的典型用法代码示例。如果您正苦于以下问题:Java SMSSDK.EVENT_GET_VERIFICATION_CODE属性的具体用法?Java SMSSDK.EVENT_GET_VERIFICATION_CODE怎么用?Java SMSSDK.EVENT_GET_VERIFICATION_CODE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cn.smssdk.SMSSDK
的用法示例。
在下文中一共展示了SMSSDK.EVENT_GET_VERIFICATION_CODE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseEvent
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;
}
}
示例2: afterEvent
@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();
}
}
示例3: initSms
private void initSms() {
// 创建EventHandler对象
eventHandler = new EventHandler() {
public void afterEvent(int event, int result, Object data) {
if (result == SMSSDK.RESULT_COMPLETE) {
//回调完成
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//提交验证码成功
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码成功
afterVerificationCodeRequested((Boolean) data);
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
//返回支持发送验证码的国家列表
}
} else if (data instanceof Throwable) {
Throwable throwable = (Throwable) data;
String msg = throwable.getMessage();
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
ToastUtils.showShortSafe(msg);
} else {
((Throwable) data).printStackTrace();
}
}
};
// 注册监听器
SMSSDK.registerEventHandler(eventHandler);
}
示例4: init
/**
* 初始化资源,准备回调,创建监听器
*/
public static void init(Context con, SMSValidListener smsValidListener) {
if(!isReady) {
context = con;
listener = smsValidListener;
SMSSDK.initSDK(context, APPKEY, APPSEC);
handler = new EventHandler(){
@Override
public void afterEvent(int event, int result, Object data) {
if(listener == null)
return;
if(result == SMSSDK.RESULT_COMPLETE) {
if(event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE)
listener.onVerifySucceeded();
if(event == SMSSDK.EVENT_GET_VERIFICATION_CODE)
listener.onMsgSent();
} else {
listener.onVerifyFailed();
((Throwable)data).printStackTrace();
}
}
};
SMSSDK.registerEventHandler(handler);
isReady = true;
}
}
示例5: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login);
initView();
//SMSSDK.initSDK(this, "142ffc51bc7be", "ca1b80c5a359dc66dbfa0629108048e2");
SMSSDK.initSDK(this, "1488ed0f38d80", "b07247c27cd9fe697c4c56a659b0804a");
eh=new EventHandler(){
@Override
public void afterEvent(int event, int result, Object data) {
if (result == SMSSDK.RESULT_COMPLETE) {
//回调完成
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//提交验证码成功
Log.e("sms","提交验证码成功");
login();
}else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE){
//获取验证码成功
Log.e("sms","获取验证码成功 ");
}else if (event ==SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES){
//返回支持发送验证码的国家列表
Log.e("sms","获取国家列表成功 "+data.toString());
}
}else{
Log.e("code", "error");
Toast.makeText(LoginActivity.this, "code error", Toast.LENGTH_SHORT).show();
((Throwable)data).printStackTrace();
}
}
};
SMSSDK.registerEventHandler(eh);
}
示例6: handleMessage
public void handleMessage(Message msg)
{
if(msg.what == -9)
{
requestCodeBtn.setText("重新发送(" + i + ")");
}
else if(msg.what == -8)
{
requestCodeBtn.setText("获取验证码");
requestCodeBtn.setClickable(true);
i = 30;
}
else if(msg.what == -10)
{
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
if(result == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE)
{
Toast.makeText(getApplicationContext(), "提交验证码成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
else if(event == SMSSDK.EVENT_GET_VERIFICATION_CODE)
{
Toast.makeText(getApplicationContext(), "验证码已经发送", Toast.LENGTH_SHORT).show();
}
}
}
示例7: handleMessage
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
Log.e("event", "event=" + event);
if (result == SMSSDK.RESULT_COMPLETE) {
System.out.println("----" + event);
//短信注册成功后,返回MainActivity,然后提示新好友
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {//提交验证码成功
if (result == SMSSDK.RESULT_COMPLETE) {
Toast.makeText(getApplicationContext(), "依然走短信验证", Toast.LENGTH_SHORT).show();
}
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getApplicationContext(), "验证码已经发送", Toast.LENGTH_SHORT).show();
textView2.setText("验证码已经发送");
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {//返回支持发送验证码的国家列表
Toast.makeText(getApplicationContext(), "获取国家列表成功", Toast.LENGTH_SHORT).show();
countryTextView.setText(data.toString());
System.out.println("+++" + getApplicationContext());
} else if (event == SMSSDK.RESULT_ERROR) {
Toast.makeText(getApplicationContext(), "------", Toast.LENGTH_SHORT).show();
}
} else {
((Throwable) data).printStackTrace();
Toast.makeText(getApplicationContext(), "错误" + data, Toast.LENGTH_SHORT).show();
}
}
示例8: handleMessage
@Override
public void handleMessage(Message msg) {
final RegActivity activity = activityWeakReference.get();
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
if (result == SMSSDK.RESULT_COMPLETE) {
//正确进行
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(activity, "验证码已发送",
Toast.LENGTH_SHORT).show();
activity.startVerCodeCountDown();
}
});
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//验证码正确
activity.checkVerCode = true;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.stopUIDialog();
}
});
//执行注册逻辑
if (activity.checkPassword() && activity.checkVerCode) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
//打开正在注册对话框
activity.startRegUIDialog();
String disCode = activity.nonspaceConvert(activity.editDisCode.getText().toString()); //区号
String phoneNum = activity.nonspaceConvert(activity.editPhone.getText().toString()); //手机号码
String password = activity.editPassword.getText().toString(); //密码
//开启网络请求
activity.addUserOnServer(disCode, phoneNum, password);
}
});
}
}
} else {
//出现异常
int status = 0;
try{
((Throwable) data).printStackTrace();
Throwable throwable = (Throwable) data;
JSONObject object = new JSONObject(throwable.getMessage());
final String des = object.optString("detail");
status = object.optInt("status");
if (!TextUtils.isEmpty(des)) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.stopUIDialog();
Toast.makeText(activity, des, Toast.LENGTH_SHORT).show();
}
});
}
} catch (Exception e) {
SMSLog.getInstance().w(e);
}
}
}
示例9: handleMessage
@Override
public void handleMessage(Message msg) {
final FragmentVerifyPhone fragment = fragmentVerifyPhoneWeakReference.get();
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
if (result == SMSSDK.RESULT_COMPLETE) {
//正确进行
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码
Message uiMsg = new Message();
uiMsg.what = 0;
fragment.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(fragment.getContext(), "验证码已发送",
Toast.LENGTH_SHORT).show();
fragment.startVerCodeCountDown();
}
});
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//验证码正确
fragment.checkVerCode = true;
fragment.stopVerifyUIDialog();
fragment.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
fragment.fragmentResetPassword.setFindPhone(fragment.editPhone.getText().toString());
fragment.replaceFragment(fragment.fragmentResetPassword, fragment.SLIDE_FROM_RIGHT_TO_LEFT);
}
});
}
} else {
//出现异常
int status = 0;
fragment.stopVerifyUIDialog();
try{
((Throwable) data).printStackTrace();
Throwable throwable = (Throwable) data;
JSONObject object = new JSONObject(throwable.getMessage());
final String des = object.optString("detail");
status = object.optInt("status");
if (!TextUtils.isEmpty(des)) {
fragment.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(fragment.getContext(), des, Toast.LENGTH_SHORT).show();
}
});
}
} catch (Exception e) {
SMSLog.getInstance().w(e);
}
}
}
示例10: handleMessage
@Override
public void handleMessage(Message msg) {
final ResetPhoneActivity activity = activityWeakReference.get();
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
if (result == SMSSDK.RESULT_COMPLETE) {
//正确进行
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(activity, "验证码已发送",
Toast.LENGTH_SHORT).show();
activity.startVerCodeCountDown();
}
});
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//验证码正确
activity.checkVerCode = true;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.stopUIDialog();
}
});
//执行修改逻辑
if (activity.checkVerCode) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
//打开正在执行对话框
activity.startRegUIDialog();
String phoneNum = activity.nonspaceConvert(activity.ETNewPhone.getText().toString()); //手机号码
//开启网络请求
activity.updateUserOnServer(phoneNum);
}
});
}
}
} else {
//出现异常
int status = 0;
try{
((Throwable) data).printStackTrace();
Throwable throwable = (Throwable) data;
JSONObject object = new JSONObject(throwable.getMessage());
final String des = object.optString("detail");
status = object.optInt("status");
if (!TextUtils.isEmpty(des)) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.stopUIDialog();
Toast.makeText(activity, des, Toast.LENGTH_SHORT).show();
}
});
}
} catch (Exception e) {
SMSLog.getInstance().w(e);
}
}
}
示例11: initShareSDK
private void initShareSDK() {
// 暂时支持中国
SMSSDK.initSDK(getActivity(), Constants.MOB_APP_KEY, Constants.MOB_APP_SECRET);
EventHandler eh = new EventHandler() {
@Override
public void afterEvent(int event, int result, Object data) {
if (result == SMSSDK.RESULT_COMPLETE) {
//回调完成
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//提交验证码成功
Timber.d("validate code success");
registerToServer();
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码成功
Timber.d("get code vericode success");
isTimeCount = true;
count = 0;
handler.postDelayed(timeCount, INTERVAl);
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
//返回支持发送验证码的国家列表
}
} else {
showTip = Constants.INVALID;
//回调完成
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
//提交验证码失败
showTip = R.string.code_invalid;
isSubmit = false;
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
//获取验证码成功
Timber.d("get code vericode fail");
isTimeCount = false;
showTip = R.string.getcode_fail;
} else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
//返回支持发送验证码的国家列表
}
if (showTip != Constants.INVALID) {
if (getActivity() == null || getActivity().isFinishing()) {
return;
}
getActivity().runOnUiThread(() -> ToastHelper.showShortTip(showTip));
}
}
}
};
SMSSDK.registerEventHandler(eh); //注册短信回调
}
示例12: handleMessage
public void handleMessage(Message msg) {
if (msg.what == -9) {
bt_getNum.setText("重新发送(" + i + ")");
} else if (msg.what == -8) {
bt_getNum.setText("获取验证码");
bt_getNum.setClickable(true);
i = 30;
} else {
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
Log.e("event", "event=" + event);
if (result == SMSSDK.RESULT_COMPLETE) {
System.out.println("-----------验证码SMSSDK.RESULT_COMPLETE:"+SMSSDK.RESULT_COMPLETE);
// 短信注册成功后,返回MainActivity,然后提示
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {// 提交验证码成功
Toast.makeText(getApplicationContext(), "提交验证码成功",
Toast.LENGTH_SHORT).show();
/*
* 把将要发表的评论上传 跳转到上一界面 // * 1.以json的方式上传到数据库 // *
* 2.在上一界面解析得到数据
*/
dialog_yanZheng.dismiss();
System.out.println("-------Username:"
+ AppApplication.getApp().getUsername());
// Toast.makeText(ItQuan_KeJiChat_ClickImgEdit.this,
// AppApplication.getApp().getUsername(), 100).show();
Intent intent = new Intent(
ItQuan_KeJiChat_ClickImgEdit.this,
KejiChatActivity.class);
intent.putExtra("title", edit_title.getText()
.toString());// 发表标题
intent.putExtra("content", editext_content.getText()
.toString());// 发表内容
intent.putExtra("author", AppApplication.getApp()
.getUsername());// 作者名字
SimpleDateFormat date = new SimpleDateFormat("yy-MM-dd");
intent.putExtra("date", date.format(new Date()) + "");// 获得当前时间
intent.putExtra("type_quan", "iOS圈");// 默认圈子类型
System.out.println("Username-----------:"
+ AppApplication.getApp().getUsername());
// intent.putExtra("photo_path",imgPath);//得到取得的图片
// System.out.println("listPhotodata:"+listPhotodata.size());
// System.out.println("---title"+edit_title.getText()+"======"+editext_content.getText());
// intent.putExtra("photoes", img_photo);
setResult(121, intent);
finish();
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getApplicationContext(), "验证码已经发送",
Toast.LENGTH_SHORT).show();
} else {
((Throwable) data).printStackTrace();
}
}
}
}
示例13: handleMessage
@Override
public void handleMessage(Message msg) {
if (msg.what == 1) {
tv_getcode.setText("重新发送(" + i + ")");
if (i == 0) {
i = 60;
tv_getcode.setText("获取验证码");
tv_getcode.setEnabled(true);
}
} else if (msg.what == 2) {
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
if (result == SMSSDK.RESULT_COMPLETE) {
if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getActivity(), "验证码已经发送", Toast.LENGTH_SHORT).show();
} else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
DialogView.dismiss();
if(type.equals("regster")){
((PhoneRegsterActivity) getActivity()).gotoPhoneRegsterToMessgae();
}else if(type.equals("password")){
((PhoneRegsterActivity) getActivity()).gotoGetPassword();
}
// Toast.makeText(getActivity(), "验证成功", Toast.LENGTH_SHORT).show();
}
} else if (result == SMSSDK.RESULT_ERROR) {
DialogView.dismiss();
Toast.makeText(getActivity(), "验证失败,请重试", Toast.LENGTH_SHORT).show();
}
}
}