private String getChannel(String msg) { return AVUtils.getJSONValue(msg, "_channel"); }
private String getAction(String msg) { return AVUtils.getJSONValue(msg, "action"); }
@Override public void onSuccess(String content, AVException e) { if (null == e && !TextUtils.isEmpty(content)) { sessionToken = AVUtils.getJSONValue(content, SESSION_TOKEN_KEY); } callback.internalDone(e); }
@SuppressWarnings("unchecked") private String getText(String msg) { String text = AVUtils.getJSONValue(msg, "alert"); if (text != null && text.trim().length() > 0) { return text; } else { Map<String, Object> jsonMap = JSON.parseObject(msg, HashMap.class); if (jsonMap == null || jsonMap.isEmpty()) return null; Map<String, Object> data = (Map<String, Object>) jsonMap.get("data"); if (data == null || data.isEmpty()) { return null; } Object val = data.get("message"); if (val != null) { return val.toString(); } else { return null; } } } }
private String getValue(String msg, String key) { String title = AVUtils.getJSONValue(msg, key); if (title != null && title.trim().length() > 0) { return title; } else { Map<String, Object> jsonMap = JSON.parseObject(msg, HashMap.class); if (jsonMap == null || jsonMap.isEmpty()) return getApplicationName(); Map<String, Object> data = (Map<String, Object>) jsonMap.get("data"); if (data == null || data.isEmpty()) { return getApplicationName(); } Object val = data.get(key); if (val != null) { return val.toString(); } else { return getApplicationName(); } } }
@Override public void onSuccess(String content, AVException e) { if (null == e && !AVUtils.isBlankString(content)) { sessionToken = AVUtils.getJSONValue(content, SESSION_TOKEN_KEY); } callback.internalDone(e); }