PSA: Android is *only* shipping Service Worker-based Notifications

3,278 views
Skip to first unread message

Peter Beverloo

unread,
Feb 13, 2015, 9:39:45 AM2/13/15
to blink-dev
In the following patch, I'm adding a runtime feature setting enabling the embedder to disable non-Service Worker based notifications. We will be disabling them for Android.


This creates somewhat of a discrepancy between desktop platforms and Android, so I want to make sure that people are aware of this.

To clarify terminology:
    - A persistent notification is a Service Worker-based one created through ServiceWorkerRegistration.showNotification().
    - A non-persistent notification is one where events get delivered on the created JavaScript object, through "new Notification()".

On desktop, we currently support both. We can rely on the fact that the renderer processes associated with non-visible tabs continue live, allowing the notification to be interacted with. Only after the user closes the tab the notification will go unresponsive.

On Android, we will only support the Service Worker-based Notifications, and will throw a type error when the Notification object gets constructed. We do not control the lifetime of renderer processes on that platform, which means that non-SW based notifications will go unresponsive after an arbitrary amount of time - which could be immediate. This creates a very bad user experience.

In the long run, we want to either change behavior of or deprecate notifications created through the Notification constructor. This is being discussed on the following locations:


Unfortunately this is not feasible as of yet, not least of all because we're the first shipping Service Worker notifications. There also are a number of large users of notifications on desktop. The absence of notifications on the mobile Web, as well as desktop UMA, indicate that this is very unlikely to be a web-incompatible decision.

I hope this clarifies it! Let me know if there are any concerns.

Thanks,
Peter

PhistucK

unread,
Oct 17, 2016, 6:40:48 AM10/17/16
to Peter Beverloo, blink-dev
I just saw this answer -

It basically says, "want notifications on Android? Create an empty service worker". That seems like a bad advice with memory and performance repercussions instead of just using new Notification().


PhistucK

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Miguel Garcia

unread,
Oct 17, 2016, 7:11:49 AM10/17/16
to PhistucK, Peter Beverloo, blink-dev
> "want notifications on Android? Create an empty service worker".
But that does no let you handle notification clicks right? It seems a very poor workaround.

Peter Beverloo

unread,
Oct 17, 2016, 7:12:17 AM10/17/16
to PhistucK, blink-dev, Miguel Garcia
Stack Overflow seems like a more appropriate place for that feedback. Miguel has just replied to the relevant answer.

Thanks,
Peter

On Mon, Oct 17, 2016 at 11:40 AM, PhistucK <phis...@gmail.com> wrote:

PhistucK

unread,
Oct 19, 2016, 3:47:46 PM10/19/16
to Peter Beverloo, blink-dev
Sorry for the really late question, but I might have gotten mixed up. Was new Notification(...) ever supported (as in, existed on window, did not throw when called and actually showed a notification) on Android?


PhistucK

On Fri, Feb 13, 2015 at 5:39 PM, Peter Beverloo <pe...@chromium.org> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Peter Beverloo

unread,
Oct 19, 2016, 3:53:22 PM10/19/16
to Alon Gothshmidt, blink-dev
No.

Thanks,
Peter
Reply all
Reply to author
Forward
0 new messages