GoogleChromeLabs / svgomg-twa

A sample that project Trusted Web Activities technology to wrap SVGOMG in an Android Application
Apache License 2.0
519 stars 132 forks source link

How to specify a custom icon for push notifications? #73

Closed mhjam closed 4 years ago

mhjam commented 4 years ago

Our PWA uses push notifications. We managed to wrap it as a TWA, thanks to this excellent demo! Our TWA does receive push notifications, but they are shown with the Chrome icon in the status bar. Is there any way to replace that with our own, app-specific icon?

I tried putting

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

into ApplicationManifest.xml, but it didn't help.

mhjam commented 4 years ago

I found it myself: You can send the URL to the icon to be used along with the notification in the "badge" property (see https://developer.mozilla.org/en-US/docs/Web/API/notification/badge).