com.xiaomi.mipush.sdk.MiPushCommandMessage Java Examples
The following examples show how to use
com.xiaomi.mipush.sdk.MiPushCommandMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DemoMessageReceiver.java From star-zone-android with Apache License 2.0 | 6 votes |
@Override public void onReceiveRegisterResult(Context context, MiPushCommandMessage message) { Log.v(MyApp.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; MyApp.getHandler().sendMessage(msg); }
Example #2
Source File: MiPushReceiver.java From GcmForMojo with GNU General Public License v3.0 | 6 votes |
@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(); } }
Example #3
Source File: MessageReceiver.java From AndroidLinkup with GNU General Public License v2.0 | 5 votes |
@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 = ""; } }
Example #4
Source File: XiaoMiPushMessageReceiver.java From ans-android-sdk with GNU General Public License v3.0 | 5 votes |
@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); Log.e("XiaoMiPushMessageReceiver","cmdArg1:"+cmdArg1+",cmdArg2:"+cmdArg2); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { } } 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; } } }
Example #5
Source File: MiMessageReceiver.java From smart-farmer-android with Apache License 2.0 | 5 votes |
/** * 获取给服务器发送注册命令的结果,结果封装在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; } } }
Example #6
Source File: WXMessageReceiver.java From HightCopyWX with Apache License 2.0 | 5 votes |
/** * 接受客户端向服务器发送注册命令消息后返回的响应 * * @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(); }
Example #7
Source File: WXMessageReceiver.java From HightCopyWX with Apache License 2.0 | 5 votes |
/** * 接收客户端向服务器发送命令消息后返回的响应 * * @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; } } }
Example #8
Source File: XiaomiPushReceiver.java From talk-android with MIT License | 5 votes |
@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); } }); } } }
Example #9
Source File: MiuiPushMessageReceiver.java From MiPushFramework with GNU General Public License v3.0 | 5 votes |
public void onCommandResult(Context context, MiPushCommandMessage miPushCommandMessage) { logger.d("onCommandResult"); logger.d(miPushCommandMessage.toString()); if (miPushCommandMessage.getResultCode() == 0) { String command = miPushCommandMessage.getCommand(); if (miPushCommandMessage.getCommandArguments().size() > 0 && "register".equals(command)) { XMAccountManager.getInstance(context).setAccountAsAlias(); return; } return; } logger.e(miPushCommandMessage.toString()); }
Example #10
Source File: MiPushMsgReceiver.java From FastAndroid with Apache License 2.0 | 5 votes |
@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; } } }
Example #11
Source File: MiPushMsgReceiver.java From FastAndroid with Apache License 2.0 | 5 votes |
@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; } } }
Example #12
Source File: MiPushMessageReceiver.java From imsdk-android with MIT License | 5 votes |
@Override public void onCommandResult(Context context, MiPushCommandMessage message) { Logger.i(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; QPushClient.setAlias(context, PhoneInfoUtils.getUniqueID()); } } 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; } } }
Example #13
Source File: ThirdPushMessageReceiver.java From imsdk-android with MIT License | 5 votes |
@Override public void onCommandResult(Context context, MiPushCommandMessage message) { Logger.i(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; QPushClient.setAlias(context, PhoneInfoUtils.getUniqueID()); } } 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; } } }
Example #14
Source File: XiaoMiPushMessageReceiver.java From ans-android-sdk with GNU General Public License v3.0 | 5 votes |
@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); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) { AnalysysAgent.setPushID(context, PushProvider.XIAOMI, cmdArg1); } } }
Example #15
Source File: MiPushMessageReceiver.java From imsdk-android with MIT License | 4 votes |
@Override public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) { super.onReceiveRegisterResult(context, miPushCommandMessage); Logger.i(TAG + "onReceiveRegisterResult => " + miPushCommandMessage.toString()); }
Example #16
Source File: ThirdPushMessageReceiver.java From imsdk-android with MIT License | 4 votes |
@Override public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) { super.onReceiveRegisterResult(context, miPushCommandMessage); Logger.i(TAG + "onReceiveRegisterResult => " + miPushCommandMessage.toString()); }
Example #17
Source File: MiuiReceiver.java From AndroidPush with Apache License 2.0 | 4 votes |
@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; } } } }
Example #18
Source File: MiuiReceiver.java From AndroidPush with Apache License 2.0 | 4 votes |
@Override public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) { super.onReceiveRegisterResult(context, miPushCommandMessage); }
Example #19
Source File: MiMessageReceiver.java From smart-farmer-android with Apache License 2.0 | 4 votes |
/** * 获取给服务器发送命令的结果,结果封装在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; } } }
Example #20
Source File: DemoMessageReceiver.java From star-zone-android with Apache License 2.0 | 4 votes |
@Override public void onCommandResult(Context context, MiPushCommandMessage message) { Log.v(MyApp.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.i(MyApp.TAG, "OnRegisterSuccess_mRegId=" + mRegId); MyApp.getInstance().setAlias(); log = context.getString(R.string.register_success); SharedPreferencesMyUtil.storeMiRegid(MyApp.getInstance(), mRegId); String storedRegid = SharedPreferencesMyUtil.queryMiRegid(MyApp.getInstance()); Log.i(MyApp.TAG, "storedRegid=" + storedRegid); } 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); Log.i(MY_TAG, "---onCommandResult_setAlias,alias=" + 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(); } ChatWindowActivity.logList.add(0, getSimpleDate() + " " + log); Message msg = Message.obtain(); msg.obj = log; MyApp.getHandler().sendMessage(msg); }