|
@@ -59,7 +59,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
|
|
* @param content 消息内容
|
|
* @param content 消息内容
|
|
* @return json对象
|
|
* @return json对象
|
|
*/
|
|
*/
|
|
- private JSONObject generateJson(String[] alias, String alert, String content, String url,String sound,String channelId) {
|
|
|
|
|
|
+ private JSONObject generateJson(String[] alias, String alert, String content, String url,String sound,String channelId,String type) {
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
JSONArray platform = new JSONArray();// 平台
|
|
JSONArray platform = new JSONArray();// 平台
|
|
platform.add("android");
|
|
platform.add("android");
|
|
@@ -89,9 +89,21 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
|
|
JSONObject android_extras = new JSONObject();// android额外参数
|
|
JSONObject android_extras = new JSONObject();// android额外参数
|
|
android_extras.put("type", "infomation");
|
|
android_extras.put("type", "infomation");
|
|
android_extras.put("url", url);
|
|
android_extras.put("url", url);
|
|
|
|
+ android_extras.put("third_url_encode",true);
|
|
android_extras.put("memo", url);
|
|
android_extras.put("memo", url);
|
|
android.put("extras", android_extras);
|
|
android.put("extras", android_extras);
|
|
|
|
|
|
|
|
+ JSONObject android_intent = new JSONObject();// android额外参数
|
|
|
|
+ if ("STUDENT".equals(type)) {
|
|
|
|
+ android_intent.put("url",
|
|
|
|
+ "intent:#Intent;action=cn.jiguang.push.customAction;component=com.cooleshow.student/com.cooleshow.student.ui.main.MainActivity;end");
|
|
|
|
+ } else {
|
|
|
|
+ android_intent.put("url",
|
|
|
|
+ "intent:#Intent;action=cn.jiguang.push.customAction;component=com.cooleshow.teacher/com.cooleshow.teacher.ui.main.MainActivity;end");
|
|
|
|
+ }
|
|
|
|
+ android.put("intent",android_intent);
|
|
|
|
+
|
|
|
|
+
|
|
JSONObject ios = new JSONObject();// ios通知内容
|
|
JSONObject ios = new JSONObject();// ios通知内容
|
|
ios.put("alert", alert);
|
|
ios.put("alert", alert);
|
|
ios.put("sound", sound);
|
|
ios.put("sound", sound);
|
|
@@ -141,7 +153,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
String authorization = "Basic " + base64_auth_string;
|
|
String authorization = "Basic " + base64_auth_string;
|
|
- return sendPostRequest(generateJson(alias, alert, content, url,sound,channelId).toString(), authorization);
|
|
|
|
|
|
+ return sendPostRequest(generateJson(alias, alert, content, url,sound,channelId,type).toString(), authorization);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|