hansemannn / titanium-firebase-cloud-messaging

Use the Firebase Cloud Messaging SDK in Axway Titanium 🚀 Edit
Other
43 stars 31 forks source link

Unable to set Android Push Notification Icon in Tray #116

Closed infinityofzeroes closed 3 years ago

infinityofzeroes commented 4 years ago

Push received but icon is showing a grey box and not the default icon or custom icon.

Have added meta data

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

and also created icons in app/platform/android/res for xxx,xx,x,h and mdpi notification_icon.png

after I build though it has error: asked me to add tools:replace="android:resource" so I updated meta data to:

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

also added code below in manifest tag: xmlns:tools="http://schemas.android.com/tools"

infinityofzeroes commented 4 years ago

did I miss anything? Im currently using firebase messaging version 3.0.1 appcelerator sdk 9.2.0 appcelerator cli 8.1.1

jonesdhtx commented 3 years ago

i'm having the same issue - did you figure out the solution?

m1ga commented 3 years ago

Its just a typo in the documentation. If you use @drawable/notificationicon your icon should be called notificationicon.png

jonesdhtx commented 3 years ago

fwiw - Also had one other problem if there's anyone else like me that was reading the instructions to quick and haphazardly - the image needs to be a mask image (white pixels on an otherwise transparent image defines the rendered icon shape). my original image had no transparent pixels so it just rendered a full square.

m1ga commented 3 years ago

thats true, but it is an Android requirement. And I recommend switching to adaptive icons (https://github.com/m1ga/from_zero_to_app/blob/master/android_adaptive_icons.md) so you'll have the foreground and background separated already. It will be a requirement for Android 12 (or at least it will look better with it)