Amit Prabhu Parrikar
Amit Prabhu Parrikar

Reputation: 241

Push Notification icon for PWA

For Progressive Web App's, when we push a notification to the mobile device; we get Chrome Browser icon in the Notification System Tray. Can we have our custom icon there?

Is there any settings required in the manifest.json file?

Upvotes: 6

Views: 10400

Answers (2)

Amit Prabhu Parrikar
Amit Prabhu Parrikar

Reputation: 241

I have found the answer to my question:

We need to pass the property badge in the options notification object. The value of the property badge is an URL to the image icon you want to show. It should be of right dimensions. This image is then masked accordingly by the device OS(Android/iOS)

More details about this property can be found here

Upvotes: 10

Marco Castelluccio
Marco Castelluccio

Reputation: 10802

The showNotification method has a parameter to specify an icon for the notification.

You can find an example on the ServiceWorker Cookbook.

Upvotes: 5

Related Questions