【问题标题】:Android cordova push icon missingAndroid 科尔多瓦推送图标丢失
【发布时间】:2017-03-21 06:05:04
【问题描述】:

接收推送通知有效,但我的应用程序图标仍然为空

尝试了以下内容以及我资产文件夹中一张图片的路径。两者都不起作用...

   let push = Push.init({
        android: {
          senderID: "XYZ",
          "icon": "drawable-ldpi-icon",
              "iconColor": "blue"
        },...

有人建议吗?

【问题讨论】:

  • 您是在使用设备推送通知还是 Genymotion ?
  • 您使用的是 Android 5 吗?它会导致您的图标获得白色蒙版的问题,如果您没有透明度,则只能为您的图标获得一个白色方块
  • 真机安卓6.0。但透明度问题可能是个问题。有解决方法的链接吗?

标签: android cordova ionic-framework ionic2 cordova-plugins


【解决方案1】:

首先,您应该将您的徽标裁剪为白色透明 png:

  • platforms/android/res/drawable-hdpi/ic_notify.png (24 × 24)
  • platforms/android/res/drawable-mdpi/ic_notify.png (36 × 36)
  • platforms/android/res/drawable-xhdpi/ic_notify.png (48 × 48)
  • platforms/android/res/drawable-xxhdpi/ic_notify.png (72 × 72)
  • platforms/android/res/drawable-xxxhdpi/ic_notify.png (96 × 96)

或者直接去this link

自动生成所有格式

把四个文件都放上

\platforms\android\res\drawable-hdpi\ic_stat_ac_unit.png
\platforms\android\res\drawable-mdpi\ic_stat_ac_unit.png
\platforms\android\res\drawable-xhdpi\ic_stat_ac_unit.png
\platforms\android\res\drawable-xxhdpi\ic_stat_ac_unit.png
\platforms\android\res\drawable-xxxhdpi\ic_stat_ac_unit.png

并缩短您指定的时间

 Push.init({
         android: {
           senderID: "XYZ",
           "icon": "ic_stat_ac_unit",
               "iconColor": "blue"
         }....

在最后一种情况下,您还将指定

    var DATA = {
        "to": "fple.....",
        "data": {
              "title":"", // Title notification
              "message": "\u270C Peace, Love \u2764",
              "color":"#cccccc", // color title notification
              "icon":"ic_stat_ac_unit",
              "smallIcon": "ic_stat_ac_unit",
              "largeIcon": "ic_stat_ac_unit"
        }};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-06
    • 2015-11-24
    • 2016-04-22
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    相关资源
    最近更新 更多