Ionic framework phonegap插件推送消息未在android上显示
我正在使用以下插件为我的离子3通知Ionic framework phonegap插件推送消息未在android上显示,ionic-framework,push-notification,ionic3,Ionic Framework,Push Notification,Ionic3,我正在使用以下插件为我的离子3通知 <plugin name="phonegap-plugin-push" spec="1.10.5"> 对于Android: private static String title = "Message Header"; private static String message = "Message Text"; String pushMessage = "{\"priority\":\"high\",\"notification
<plugin name="phonegap-plugin-push" spec="1.10.5">
对于Android:
private static String title = "Message Header";
private static String message = "Message Text";
String pushMessage = "{\"priority\":\"high\",\"notification\":{\"title\":\"" +
title +
"\",\"message\":\"" +
message +
"\"},\"to\":\"" +
DEVICE_TOKEN +
"\"}";
// Create connection to send FCM Message request.
URL url = new URL("https://fcm.googleapis.com/fcm/send");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Authorization", "key=" + SERVER_KEY);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
// Send FCM message content.
OutputStream outputStream = conn.getOutputStream();
outputStream.write(pushMessage.getBytes());
System.out.println(conn.getResponseCode());
System.out.println(conn.getResponseMessage());
我无法显示仅在单行通知中显示“消息标题”的“消息文本”
我正在尝试在Android上实现多行通知。任何提示都将不胜感激。将
消息更改为正文
:
String pushMessage = "{\"priority\":\"high\",\"notification\":{\"title\":\"" +
title +
"\",\"body\":\"" +
message +
"\"},\"to\":\"" +
DEVICE_TOKEN +
"\"}";
有关格式设置,请参阅此处:
难怪!事后诸葛亮,我没有检查身体标签。谢谢
String pushMessage = "{\"priority\":\"high\",\"notification\":{\"title\":\"" +
title +
"\",\"body\":\"" +
message +
"\"},\"to\":\"" +
DEVICE_TOKEN +
"\"}";