本文整理汇总了Java中cn.smssdk.SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES属性的典型用法代码示例。如果您正苦于以下问题:Java SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES属性的具体用法?Java SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES怎么用?Java SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cn.smssdk.SMSSDK
的用法示例。
在下文中一共展示了SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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);
}
示例4: 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();
}
}
示例5: 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); //注册短信回调
}