2017-03-31 75 views
1

我能夠收到推送通知和下面的推送通知是我的代碼寫在如何更改圖標/徽標離子2

let push = Push.init({ 
     android: { 
      senderID: '907xxxxx860', 
      icon: 'icon' 
     }, 
     ios: { 
      alert: 'true', 
      badge: true, 
      sound: 'false' 
     }, 
     windows: {} 
     }); 

我在android版測試5

在我的資產文件夾中,我在此路徑中有一個圖像assets/images/home/KmartLogo.png。我想要這個圖像作爲我的標誌爲Android。

我該如何做到這一點。根據該文件doc我試圖給的路徑在這樣icon: 'icon'在這個icon:assets/images/home/KmartLogo.png,但它不工作我怎樣才能改變我的標誌

更新通知圖像我得到img

+0

你是說它顯示白色圖標?如果是這樣的話,那隻針對Android 5的具體問題僅僅是因爲Android 5使用了模具圖標。 – Djamware

+0

也許你得到的路徑錯誤..試試'。/ assets/images/home/KmartLogo.png' –

+0

我試過你給我的方式我不能得到標識@suraj –

回答

0

icon不應該包含擴展名

Doc

可繪製資源的名稱作爲小圖標。名稱 不應包含擴展名。

android: { 
      senderID: '907xxxxx860', 
      icon: './assets/images/home/KmartLogo' 
     }, 
+0

當我嘗試你的答案,我的視覺工作室編輯器顯示此問題'[ts]類型'{android:{senderID:string; image:string; }; ios:{alert:string;徽章:真的;聲音:字符串...'不能分配給'PushOptions'類型的參數。 屬性「android」的類型不兼容。 輸入'{senderID:string; image:string; }'不能分配爲鍵入'AndroidPushOptions'。 對象字面量只能指定已知的屬性,而類型'AndroidPushOptions'中不存在'圖像'。 –

+0

哦..請看我上面的更新。 – Sampath

+0

我現在仍然無法更新推送通知 –