本文整理汇总了Java中cn.smssdk.SMSSDK.RESULT_COMPLETE属性的典型用法代码示例。如果您正苦于以下问题:Java SMSSDK.RESULT_COMPLETE属性的具体用法?Java SMSSDK.RESULT_COMPLETE怎么用?Java SMSSDK.RESULT_COMPLETE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cn.smssdk.SMSSDK
的用法示例。
在下文中一共展示了SMSSDK.RESULT_COMPLETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
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;
}
示例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: dispatchMessage
@SuppressWarnings("unchecked")
@Override
public void dispatchMessage(Message msg) {
if (msg.arg1 != SMSSDK.RESULT_COMPLETE) {
Timber.w((Throwable) msg.obj);
mCallback.onActionFailure(msg.what, null, null);
return;
}
if (msg.what == GET_SUPPORTED_COUNTRIES) {
final HashMap<String, String> countryList =
getCountryList((ArrayList<HashMap<String, Object>>) msg.obj);
mCallback.onActionSuccess(msg.what, new SMSCountryListResponse(countryList));
} else if (msg.what == SEND_CAPTCHA) {
mCallback.onActionSuccess(msg.what, new SMSSentCaptchaResponse((Boolean) msg.obj));
} else if (msg.what == CHECK_CAPTCHA) {
final HashMap<String, Object> map = (HashMap<String, Object>) msg.obj;
final String phone = (String) map.get("phone");
final String countryCode = (String) map.get("country");
mCallback.onActionSuccess(msg.what, new SMSCheckCaptchaResponse(phone, countryCode));
}
}
示例4: 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);
}
示例5: 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) {
//提交验证码成功
doReg();
// dialog.setMessage("正在提交注册信息");
// dialog.show();
}
} 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);
}
示例6: 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;
}
}
示例7: 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);
}
示例8: 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();
}
}
示例9: initData
private void initData(){
handler = new EventHandler() {
@SuppressWarnings("unchecked")
public void afterEvent(final int event, final int result, final Object data) {
if (result == SMSSDK.RESULT_COMPLETE) {
if (event == SMSSDK.EVENT_GET_CONTACTS) {
// 请求获取本地联系人列表
ArrayList<HashMap<String,Object>> rawList = (ArrayList<HashMap<String,Object>>) data;
if (rawList == null) {
contactsInMobile = new ArrayList<HashMap<String,Object>>();
} else {
contactsInMobile = (ArrayList<HashMap<String,Object>>) rawList.clone();
}
refreshContactList();
} else if (event == SMSSDK.EVENT_GET_FRIENDS_IN_APP) {
// 请求获取服务器上,应用内的朋友
friendsInApp = (ArrayList<HashMap<String,Object>>) data;
SMSSDK.getContacts(false);
}
} else {
runOnUIThread(new Runnable() {
public void run() {
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
// 网络错误
int resId = ResHelper.getStringRes(activity, "smssdk_network_error");
if (resId > 0) {
Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show();
}
}
});
}
}
};
// 注册事件监听器
SMSSDK.registerEventHandler(handler);
if(friendsInApp != null && friendsInApp.size() > 0) {
// 获取本地联系人
SMSSDK.getContacts(false);
} else {
// 获取应用内的好友列表
SMSSDK.getFriendsInApp();
}
}
示例10: 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);
}
}
}
示例11: 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);
}
}
}
示例12: 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);
}
}
}
示例13: initData
private void initData(){
handler = new EventHandler() {
@SuppressWarnings("unchecked")
public void afterEvent(final int event, final int result, final Object data) {
if (result == SMSSDK.RESULT_COMPLETE) {
if (event == SMSSDK.EVENT_GET_CONTACTS) {
// 请求获取本地联系人列表
ArrayList<HashMap<String,Object>> rawList = (ArrayList<HashMap<String,Object>>) data;
if (rawList == null) {
contactsInMobile = new ArrayList<HashMap<String,Object>>();
} else {
contactsInMobile = (ArrayList<HashMap<String,Object>>) rawList.clone();
}
refreshContactList();
} else if (event == SMSSDK.EVENT_GET_FRIENDS_IN_APP) {
// 请求获取服务器上,应用内的朋友
friendsInApp = (ArrayList<HashMap<String,Object>>) data;
SMSSDK.getContacts(false);
}
} else {
runOnUIThread(new Runnable() {
public void run() {
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
// 网络错误
int resId = getStringRes(activity, "smssdk_network_error");
if (resId > 0) {
Toast.makeText(activity, resId, Toast.LENGTH_SHORT).show();
}
}
});
}
}
};
// 注册事件监听器
SMSSDK.registerEventHandler(handler);
if(friendsInApp != null && friendsInApp.size() > 0){
// 获取本地联系人
SMSSDK.getContacts(false);
}else{
// 获取应用内的好友列表
SMSSDK.getFriendsInApp();
}
}
示例14: 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); //注册短信回调
}
示例15: 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();
}
}
}
}