| | |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | | if (msgCode == Constant.FETCH_RTK_PLATFORM_INFO) { |
| | | if (mRTKConfig != null) { |
| | | String rtkjson = gson.toJson(mRTKConfig); |
| | | |
| | | //去除id字段 |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(rtkjson); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | jsonObject.remove("_id"); |
| | | rtkjson = null; |
| | | rtkjson = jsonObject.toString(); |
| | | MyLog.i(TAG, "RTK配置信息:" + rtkjson); |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_RTK_PLATFORM_INFO, rtkjson); |
| | | } else { |
| | | MyLog.d(TAG, "RTKConfig未取到数据"); |
| | | } |
| | | sendRtkConfigInfo(); |
| | | } |
| | | if (msgCode == Constant.RTK_PLATFORM_REGISTER_STATUS) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | private void sendRtkConfigInfo() { |
| | | if (mRTKConfig != null) { |
| | | String rtkjson = gson.toJson(mRTKConfig); |
| | | |
| | | //去除id字段 |
| | | JSONObject jsonObject = null; |
| | | try { |
| | | jsonObject = new JSONObject(rtkjson); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | jsonObject.remove("_id"); |
| | | rtkjson = null; |
| | | rtkjson = jsonObject.toString(); |
| | | MyLog.i(TAG, "RTK配置信息:" + rtkjson); |
| | | AYSdk.getInstance().sendCmd(Constant.PUSH_RTK_PLATFORM_INFO, rtkjson); |
| | | } else { |
| | | MyLog.d(TAG, "RTKConfig未取到数据"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | |
| | | MyLog.i(TAG, "RTKConfig Changed: " + (rtkConfig != null ? rtkConfig.toString() : "null")); |
| | | mRTKConfig = rtkConfig; |
| | | sendRtkConfigInfo(); |
| | | } |
| | | }); |
| | | |