Res/drawable Files In Intel Xdk
Solution 1:
This actually is part of the solution to a popular problem with the local notifications plugin in Intel XDK. The wiki tells us that there are 3 possibilities to load the notification icon, but only when using the res type it seemed to work for me. I haven't found any other clear solution on this and I haven't been able to test it on iOS, but here is what I did on Android:
I located the plugin folder in my Intel XDK project (de.appplant.cordova.plugin.local-notification for me, but I'll call it local-notification from now on).
Created android res folder: local-notification\src\android\res
Since I'm still not sure about all the different resolutions, I created 4 folders: drawable-hdpi, drawable-mdpi, drawable-xhdpi and drawable-xxhdpi and put my differently sized icons in them. So in the end I had f.e.: local-notification/src/android/res/drawable-hdpi/noti_icon.png
Now I followed Tom's instructions and the hint given in this reply and added the following lines to local-notification\plugin.xml file:
<resource-filesrc="src/android/res/drawable-hdpi/noti_icon.png"target="res/drawable-hdpi/noti_icon.png" /><resource-filesrc="src/android/res/drawable-mdpi/noti_icon.png"target="res/drawable-mdpi/noti_icon.png" /><resource-filesrc="src/android/res/drawable-xhdpi/noti_icon.png"target="res/drawable-xhdpi/noti_icon.png" /><resource-filesrc="src/android/res/drawable-xxhdpi/noti_icon.png"target="res/drawable-xxhdpi/noti_icon.png" />
The icon is now finally available as ressource and can be used via the res type with the local notifcations plugin by simply:
cordova.plugins.notification.local.schedule({
...your other options... ,
icon: "noti_icon",
smallicon:"noti_icon"
});
(You don't need to add the filetype or "res://" type)
Finally, instead of seeing the Android bell icon, you should now see your own icon.
There are some other google guidelines to take care of, like a transparent background on your .png, but I'm not sure and haven't tested if these specs have any influence on the appearance.
Solution 2:
I beilive this question is asked to get over the nasty white icon of a cordova app when it receive a push notification.
One painless way is to use this popular plugin to register and receive push notifications: https://github.com/phonegap/phonegap-plugin-push
Then just simply put the icon somewhere in your apps's folder and when sending the message from your push server, specify the icon by the image property like this:
{"registration_ids":["my device id"],"data":{"title":"Large Icon","message":"Loaded from assets folder","image":"www/image/logo.png"}}
You can reffer to this link: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md
Post a Comment for "Res/drawable Files In Intel Xdk"