Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to add badge notifications using progressive web apps (PWA)?

I'm developing a progressive web application (PWA) that will eventually send notifications to users.

I already know I'm able to send push notifications (like any regular app), as explained in the following blog post: https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/?hl=en-us.

I also know that I can add a PWA to the home screen, by creating a simple manifest file (https://developers.google.com/web/updates/2014/11/Support-for-installable-web-apps-with-webapp-manifest-in-chrome-38-for-Android).

However, after having the app in home screen, I would like to add a "hint" to users, letting they know that they have to access the application. A great way to do that is doing something like a "badge notification" (as showed in Facebook icon on the image below).

Image showing a badge notification example on the Facebook icon

Is it possible to add this kind of behavior using progressive web applications?


Update - December, 15th, 2018

Google recently launched a post explaining about the so called "Badging for App Icons", which is pretty exciting:

https://developers.google.com/web/updates/2018/12/badging-api

Update - September, 28th, 2018

Relevant Links:
  • https://bugs.chromium.org/p/chromium/issues/detail?id=719176&desc=2
  • https://bugs.chromium.org/p/chromium/issues/detail?id=685159
  • https://github.com/mgiuca/badging/blob/master/explainer.md
  • https://docs.google.com/document/d/1AmX53h-gk8wN7LPMi_Mq7fsIMgsMKRD6zKa1Ymxxvvc/edit#

As Josh Lee pointed out in Is there a way to add badge notifications using progressive web apps (PWA)?, there are some discussions about the subject on the chromium team.

Looking at the discussion:

FYI, the notification indicators are being pushed to M-71.

and

Thanks for the heads up. That's fine for us because while we hope to have this testable behind a flag in M70, there's no way we'll be launching the API before (at least) M71.

So, maybe, at least for now, it seems that it's not possible to add badge notifications for PWAs, but maybe in the future we'll be able to do that.

like image 610
William Martins Avatar asked Jul 28 '17 15:07

William Martins


People also ask

Can Progressive Web Apps give notifications?

all support native push notifications. Beyond the browser Windows and Android both support push. And if you are wondering if Edge, FireFox or Chrome on iOS support push, they don't.

Can PWA do push notifications iOS?

Can PWA send push notifications to iOS? There is, in practice, no official support for push notifications from Apple. However, there are some ways that developers find that get around the system a bit.

How do I get notification badges on Android?

Turn on App icon badges from Settings.Navigate back to the main Settings screen, tap Notifications, and then tap Advanced settings. Tap the switch next to App icon badges to turn them on.


2 Answers

Just in case some one comes looking for answer here

It is supported now in chrome and chromium based browsers. Here are the imp Links to know more

  • W3C Badging API Explainer

  • Demo App (installable PWA)

  • Demo App Source Code

  • Web.dev in short know how

like image 165
nikhil mehta Avatar answered Oct 07 '22 21:10

nikhil mehta


Update 2020: check this nikhil mehta's answer below for the latest information:

The App Badging API works on Windows, and macOS, in Chrome 81 or later. It has also been confirmed to work on Edge 84 or later. Support for Chrome OS is in development and will be available in a future release of Chrome. On Android, the Badging API is not supported. Instead, Android automatically shows a badge on app icon for the installed web app when there is an unread notification, just as for Android apps.

Original answer:

Looks like this is on the roadmap, possibly behind a flag in M71.

  • crbug.com/719176
  • crbug.com/685159

(So, a late October beta (schedule). There's no other activity on the bug to corroborate that, but most of the WebAPK work was not on public bugs, FWIW.)

like image 45
Josh Lee Avatar answered Oct 07 '22 19:10

Josh Lee