本文整理汇总了Java中com.xiaomi.mipush.sdk.MiPushCommandMessage.getReason方法的典型用法代码示例。如果您正苦于以下问题:Java MiPushCommandMessage.getReason方法的具体用法?Java MiPushCommandMessage.getReason怎么用?Java MiPushCommandMessage.getReason使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xiaomi.mipush.sdk.MiPushCommandMessage
的用法示例。
在下文中一共展示了MiPushCommandMessage.getReason方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.MiPushCommandMessage; //导入方法依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
Log.v(MYTAG,
"onReceiveRegisterResult is called. " + message.toString());
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
String log;
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
deviceMiToken = cmdArg1;
Log.v(MYTAG,
"小米推送token:" + deviceMiToken);
} else {
Log.v(MYTAG,
"小米推送注册失败!" );
}
} else {
log = message.getReason();
}
}
示例2: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.MiPushCommandMessage; //导入方法依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
Log.v(MyApplication.TAG, "onReceiveRegisterResult is called. " + message.toString());
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
String log;
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
log = context.getString(R.string.register_success);
} else {
log = context.getString(R.string.register_fail);
}
} else {
log = message.getReason();
}
Message msg = Message.obtain();
msg.obj = log;
MyApplication.getHandler().sendMessage(msg);
}
示例3: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.MiPushCommandMessage; //导入方法依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
//注意:本回调在非主UI线程
Log4jLog.d(LONG_TAG, "onReceiveRegisterResult is called. " + message.toString());
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
String log;
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
log = "register_success, mRegId = " + mRegId;
ThirdPartyPushHelper.pushToken = mRegId;
ThirdPartyPushHelper.setPushToken(true);
} else {
log = "register_fail: " + message.getReason();
}
} else {
log = message.getReason();
}
Log4jLog.d(LONG_TAG, log);
}
示例4: onCommandResult
import com.xiaomi.mipush.sdk.MiPushCommandMessage; //导入方法依赖的package包/类
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
Log.v(MyApplication.TAG,
"onCommandResult is called. " + message.toString());
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
String cmdArg2 = ((arguments != null && arguments.size() > 1) ? arguments.get(1) : null);
String log;
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
log = context.getString(R.string.register_success);
} else {
log = context.getString(R.string.register_fail);
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
log = context.getString(R.string.set_alias_success, mAlias);
} else {
log = context.getString(R.string.set_alias_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
log = context.getString(R.string.unset_alias_success, mAlias);
} else {
log = context.getString(R.string.unset_alias_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_SET_ACCOUNT.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAccount = cmdArg1;
log = context.getString(R.string.set_account_success, mAccount);
} else {
log = context.getString(R.string.set_account_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_UNSET_ACCOUNT.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAccount = cmdArg1;
log = context.getString(R.string.unset_account_success, mAccount);
} else {
log = context.getString(R.string.unset_account_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
log = context.getString(R.string.subscribe_topic_success, mTopic);
} else {
log = context.getString(R.string.subscribe_topic_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
log = context.getString(R.string.unsubscribe_topic_success, mTopic);
} else {
log = context.getString(R.string.unsubscribe_topic_fail, message.getReason());
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
log = context.getString(R.string.set_accept_time_success, mStartTime, mEndTime);
} else {
log = context.getString(R.string.set_accept_time_fail, message.getReason());
}
} else {
log = message.getReason();
}
MainActivity.logList.add(0, getSimpleDate() + " " + log);
Message msg = Message.obtain();
msg.obj = log;
MyApplication.getHandler().sendMessage(msg);
}
示例5: onCommandResult
import com.xiaomi.mipush.sdk.MiPushCommandMessage; //导入方法依赖的package包/类
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
//注意:本回调在非主UI线程
Log4jLog.d(LONG_TAG, "onCommandResult is called. " + message.toString());
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
String cmdArg2 = ((arguments != null && arguments.size() > 1) ? arguments.get(1) : null);
String log;
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
log = "register_success";
} else {
log = "register_fail";
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
log = "set_alias_success: " + mAlias;
} else {
log = "set_alias_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
log = "unset_alias_success: " + mAlias;
} else {
log = "unset_alias_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_SET_ACCOUNT.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAccount = cmdArg1;
log = "set_account_success: " + mAccount;
} else {
log = "set_account_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_UNSET_ACCOUNT.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAccount = cmdArg1;
log = "unset_account_success" + mAccount;
} else {
log = "unset_account_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
log = "subscribe_topic_success: " + mTopic;
} else {
log = "subscribe_topic_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
log = "unsubscribe_topic_success: " + mTopic;
} else {
log = "unsubscribe_topic_fail: " + message.getReason();
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
log = "set_accept_time_success: " + mStartTime + " " + mEndTime;
} else {
log = "set_accept_time_fail: " + message.getReason();
}
} else {
log = message.getReason();
}
Log4jLog.d(LONG_TAG, log);
}