本文整理汇总了Java中com.xiaomi.mipush.sdk.ErrorCode类的典型用法代码示例。如果您正苦于以下问题:Java ErrorCode类的具体用法?Java ErrorCode怎么用?Java ErrorCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorCode类属于com.xiaomi.mipush.sdk包,在下文中一共展示了ErrorCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
Log.v(DemoApplication.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.d("register","success");
//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;
DemoApplication.getHandler().sendMessage(msg);*/
}
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:25,代码来源:DemoMessageReceiver.java
示例2: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的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();
}
}
开发者ID:heipidage,项目名称:GcmForMojo,代码行数:23,代码来源:MiPushReceiver.java
示例3: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的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);
}
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:23,代码来源:MessageReceiver.java
示例4: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的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);
}
开发者ID:entboost,项目名称:EntboostIM,代码行数:26,代码来源:XiaoMiPushReceiver.java
示例5: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
String command = message.getCommand();
Log.d(TAG,"onCommandResult => " + message.toString());
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
}
}
}
开发者ID:joyrun,项目名称:MixPush,代码行数:35,代码来源:MiPushMessageReceiver.java
示例6: a
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
public void a(byte[] bArr, String str) {
if (bArr == null) {
k.a(this, str, bArr, ErrorCode.ERROR_INVALID_PAYLOAD, "null payload");
com.xiaomi.channel.commonutils.logger.b.a("register request without payload");
return;
}
com.xiaomi.xmpush.thrift.h hVar = new com.xiaomi.xmpush.thrift.h();
try {
u.a(hVar, bArr);
if (hVar.a == com.xiaomi.xmpush.thrift.a.a) {
com.xiaomi.xmpush.thrift.j jVar = new com.xiaomi.xmpush.thrift.j();
try {
u.a(jVar, hVar.f());
k.a(hVar.j(), bArr);
a(new j(this, hVar.j(), jVar.d(), jVar.h(), bArr));
return;
} catch (Throwable e) {
com.xiaomi.channel.commonutils.logger.b.a(e);
k.a(this, str, bArr, ErrorCode.ERROR_INVALID_PAYLOAD, " data action error.");
return;
}
}
k.a(this, str, bArr, ErrorCode.ERROR_INVALID_PAYLOAD, " registration action required.");
com.xiaomi.channel.commonutils.logger.b.a("register request with invalid payload");
} catch (Throwable e2) {
com.xiaomi.channel.commonutils.logger.b.a(e2);
k.a(this, str, bArr, ErrorCode.ERROR_INVALID_PAYLOAD, " data container error.");
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:30,代码来源:XMPushService.java
示例7: a
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
public void a(c cVar, c cVar2, int i) {
if (cVar2 == c.binded) {
k.a(this.a);
k.b(this.a);
} else if (cVar2 == c.unbind) {
k.a(this.a, ErrorCode.ERROR_SERVICE_UNAVAILABLE, " the push is not connected.");
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ao.java
示例8: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的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);
}
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:76,代码来源:MessageReceiver.java
示例9: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) {
Logger.d(TAG, "command result");
String command = miPushCommandMessage.getCommand();
List<String> arguments = miPushCommandMessage.getCommandArguments();
final String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (miPushCommandMessage.getResultCode() == ErrorCode.SUCCESS && BizLogic.isLogin()) {
if (StringUtil.isBlank(MainApp.PREF_UTIL.getString(Constant.XIAOMI_TOKEN))) {
MainApp.PREF_UTIL.putString(Constant.XIAOMI_TOKEN, cmdArg1);
}
TalkClient.getInstance().getTalkApi()
.postToken(cmdArg1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Object>() {
@Override
public void call(Object o) {
MainApp.PREF_UTIL.putString(Constant.XIAOMI_TOKEN, cmdArg1);
Logger.d(TAG, "xiaomi push register success: " + cmdArg1);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Logger.e(TAG, "xiaomi push register", throwable);
}
});
}
}
}
开发者ID:jianliaoim,项目名称:talk-android,代码行数:32,代码来源:XiaomiPushReceiver.java
示例10: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 接收客户端向服务器发送命令消息后返回的响应
*
* @param context
* @param message
*/
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
}
}
}
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:40,代码来源:WXMessageReceiver.java
示例11: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 接受客户端向服务器发送注册命令消息后返回的响应
*
* @param context
* @param message
*/
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
}
// Log.d("TAG", "register:" + mRegId);
SPUtils.putString("regId", mRegId).commit();
}
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:21,代码来源:WXMessageReceiver.java
示例12: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 获取给服务器发送注册命令的结果,结果封装在MiPushCommandMessage类中
*/
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
}
}
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:16,代码来源:MiMessageReceiver.java
示例13: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 用来接受客户端向服务器发送注册命令消息后返回的响应
*
* @param context
* @param message
*/
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
Logger.v(TAG + "onReceiveRegisterResult" + 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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
}
}
开发者ID:arieshao,项目名称:Integration,代码行数:20,代码来源:PushReceiver.java
示例14: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 用来接收客户端向服务器发送命令消息后返回的响应
*
* @param context
* @param message
*/
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
Logger.v(TAG + "onCommandResult" + 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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
}
}
}
开发者ID:arieshao,项目名称:Integration,代码行数:41,代码来源:PushReceiver.java
示例15: onReceiveRegisterResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) {
String command = message.getCommand();
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (mRemoteMessageSDKStateHandler != null) {
mRemoteMessageSDKStateHandler.onReceiveRegisterResult(message.getResultCode() == ErrorCode.SUCCESS);
}
if (message.getResultCode() == ErrorCode.SUCCESS) {
updateContent(context, context.getString(R.string.msg_push_binded));
} else {
updateContent(context, "注册失败,错误码:" + message.getResultCode());
}
}
}
开发者ID:legendmohe,项目名称:LEHomeMobile_android,代码行数:15,代码来源:RemoteMessageReceiver.java
示例16: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onCommandResult(Context arg0, MiPushCommandMessage message) {
String command = message.getCommand();
List<String> arguments = message.getCommandArguments();
String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
MyApplication.Push_Reg_ID = cmdArg1;
} else {
MyApplication.Push_Reg_ID = "";
}
} else {
MyApplication.Push_Reg_ID = "";
}
}
开发者ID:csuyzb,项目名称:AndroidLinkup,代码行数:16,代码来源:MessageReceiver.java
示例17: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
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;
DemoApplication.getHandler().sendMessage(msg);*/
}
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:75,代码来源:DemoMessageReceiver.java
示例18: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 方法用来接收客户端向服务器发送命令后的响应结果。
*/
@Override
public void onCommandResult(Context context, MiPushCommandMessage message) {
int mipush_set_alias_fail = context.getResources().getIdentifier("mipush_set_alias_fail", "string", context.getPackageName());
int mipush_unset_alias_fail = context.getResources().getIdentifier("mipush_unset_alias_fail", "string", context.getPackageName());
Log.v(LOG_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 log;
Intent intent = new Intent();
intent.setAction(JINGOAL_PUSH_ACTION);
intent.putExtra(NXTReceiver.MESSAGE_TYPE, NXTReceiver.MessageType.COMMAND);
if (COMMAND_REGISTER.equals(command)) {
Log.i(LOG_TAG, "XM_TOKEN:" + cmdArg1);
SharedPreferences sharedPreference =
context.getSharedPreferences(NXTReceiver.JINGOAL_PUSH_SP, Context.MODE_PRIVATE);
SharedPreferences.Editor edit = sharedPreference.edit();
edit.putString(NXTReceiver.SP_KEY_XIAOMI_TOKEN, cmdArg1);
edit.commit();
intent.putExtra(COMMAND_TYPE, COMMAND_REGISTER);
if (message.getResultCode() == ErrorCode.SUCCESS) {
intent.putExtra(NXTReceiver.COMMAND_RESULT, true);
} else {
intent.putExtra(NXTReceiver.COMMAND_RESULT, false);
}
context.sendBroadcast(intent);
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
intent.putExtra(COMMAND_TYPE, NXTReceiver.COMMAND_SET_ALIAS);
if (message.getResultCode() == ErrorCode.SUCCESS) {
intent.putExtra(NXTReceiver.COMMAND_RESULT, true);
} else {
log = context.getString(mipush_set_alias_fail, message.getReason());
intent.putExtra(NXTReceiver.COMMAND_RESULT, false);
Log.e(LOG_TAG, log);
}
context.sendBroadcast(intent);
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
intent.putExtra(COMMAND_TYPE, NXTReceiver.COMMAND_DELETE_ALIAS);
if (message.getResultCode() == ErrorCode.SUCCESS) {
intent.putExtra(NXTReceiver.COMMAND_RESULT, true);
} else {
log = context.getString(mipush_unset_alias_fail, message.getReason());
intent.putExtra(NXTReceiver.COMMAND_RESULT, false);
Log.e(LOG_TAG, log);
}
context.sendBroadcast(intent);
}
}
开发者ID:pengkobe,项目名称:nxtpush-cordova-plugin,代码行数:56,代码来源:XiaomiReceiver.java
示例19: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
@Override
public void onCommandResult(final Context context, MiPushCommandMessage message) {
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
if (mPushInterface != null) {
JHandler.handler().post(new Runnable() {
@Override
public void run() {
mPushInterface.onRegister(context, mRegId);
}
});
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
if (mPushInterface != null) {
JHandler.handler().post(new Runnable() {
@Override
public void run() {
mPushInterface.onAlias(context, mAlias);
}
});
}
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
}
}
}
}
开发者ID:jiang111,项目名称:AndroidPush,代码行数:52,代码来源:MiuiReceiver.java
示例20: onCommandResult
import com.xiaomi.mipush.sdk.ErrorCode; //导入依赖的package包/类
/**
* 获取给服务器发送命令的结果,结果封装在MiPushCommandMessage类中
*/
@Override
public void onCommandResult(final Context context, MiPushCommandMessage message) {
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);
if (MiPushClient.COMMAND_REGISTER.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mRegId = cmdArg1;
//注册
if (mPushListener != null) {
PushHandler.handler().post(new Runnable() {
@Override
public void run() {
mPushListener.onRegister(context, mRegId);
}
});
}
}
} else if (MiPushClient.COMMAND_SET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
//别名
if (mPushListener != null) {
PushHandler.handler().post(new Runnable() {
@Override
public void run() {
mPushListener.onAlias(context, mAlias);
}
});
}
}
} else if (MiPushClient.COMMAND_UNSET_ALIAS.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mAlias = cmdArg1;
}
} else if (MiPushClient.COMMAND_SUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_UNSUBSCRIBE_TOPIC.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mTopic = cmdArg1;
}
} else if (MiPushClient.COMMAND_SET_ACCEPT_TIME.equals(command)) {
if (message.getResultCode() == ErrorCode.SUCCESS) {
mStartTime = cmdArg1;
mEndTime = cmdArg2;
}
}
}
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:59,代码来源:MiMessageReceiver.java
注:本文中的com.xiaomi.mipush.sdk.ErrorCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论