2017-02-15 33 views
1

我使用phonegap-plugin-push插件在我的PhoneGap應用程序,我想設置一個不同的圖標,而不是使用的標識應用程序,用於推送通知。 繼文檔之後,我會使用此代碼來完成此操作;無論如何這不工作,它總是使用應用程序圖標,而不是我想要的新圖標。的推送通知添加新的圖標,在PhoneGap的

var push = PushNotification.init({ 
    "android": { 
     "senderID": "xxx", 
     "icon": "ic_stat_icon" 
    } 
}); 

我把我的ic_stat_icon.png圖像中的platform/android/res文件夾

回答

0

嘗試把你的形象在platform/android/res/drawable

我不知道是否有必要,但你也可以嘗試把你的圖片放在其他drawables文件夾中(drawable-ldpi,drawable-mdpi,drawable-hdpi等)。

+0

謝謝,但我已經嘗試做了,沒有解決問題@ shino47 – Marco24690

0

我花了在這個問題上整個下午 - 所做的一切,它的push插件文件和更多的說 - 這似乎是把一個額外的標籤在你的Android清單解決問題:

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

...其中icontrans是我的圖標的名稱。

僅供參考,我也把圖標到每個用我的config.xml中的以下的資源/文件夾繪製的:

<resource-file src="res/icon/icon-18-trans.png" target="res/drawable-ldpi/icontrans.png" /> 
    <resource-file src="res/icon/icon-24-trans.png" target="res/drawable-mdpi/icontrans.png" /> 
    <resource-file src="res/icon/icon-36-trans.png" target="res/drawable-hdpi/icontrans.png" /> 
    <resource-file src="res/icon/icon-48-trans.png" target="res/drawable-xhdpi/icontrans.png" /> 
    <resource-file src="res/icon/icon-72-trans.png" target="res/drawable-xxhdpi/icontrans.png" /> 
    <resource-file src="res/icon/icon-96-trans.png" target="res/drawable-xxxhdpi/icontrans.png" /> 

不知道這件事情做的更高版本的平臺(I」 m瞄準SDK 26)或我使用Firebase發送通知的事實。