Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework phonegap插件推送消息未在android上显示_Ionic Framework_Push Notification_Ionic3 - Fatal编程技术网

Ionic framework phonegap插件推送消息未在android上显示

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

我正在使用以下插件为我的离子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\":{\"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 +
            "\"}";