简体   繁体   English

加载应用程序之前的默认推送通知白色方块

[英]Default push-notification white square before app is loaded

I've managed to suscessfully setup phonegap-push-plugin on Android - I am able to receive messages from FCM. 我已经成功地在Android上设置了phonegap-push-plugin - 我能够从FCM接收消息。 When I've launched the app and recieve a message my custom icon is displayed in the status bar..Great! 当我启动应用程序并收到消息时,我的自定义图标显示在状态栏中。很棒!

BUT, when the app has not been launched and a message is recieved the icon defaults back to the white Square. 但是,当应用程序尚未启动并收到消息时,图标默认返回白色方块。

Plugin: 插入:

phonegap-version cli 8.0.0 phonegap-version cli 8.0.0
phonegap-plugin-push v2.1.3 phonegap-plugin-push v2.1.3

Code used when app has launched: 应用程序启动时使用的代码:

const push =  PushNotification.init({
    android: {
        senderID: "418827009056", 
        sound: "true",
        vibrate: "true",
        icon: "notification",
        iconColor: "#002060",
        clearBadge : true,
    },
    browser: {
        pushServiceURL: 'http://push.api.phonegap.com/v1/push'
    },
    ios: {
        alert: "true",
        badge: "true",
        sound: "true"
    },
    windows: {}
  });

Is there a way in the config.xml to add a default icon for push-notifications but the app has launched? config.xml中是否有一种方法可以为推送通知添加默认图标,但应用程序已启动?

Use this code in AndroidManifest.xml : AndroidManifest.xml使用此代码:

<application>
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_notification" />
<application />

as mentioned in FCM android documentation if you not need to send icon name in notification response or there is trouble to get name. 如FCM android文档中所述,如果您不需要在通知响应中发送图标名称或者无法获取名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM