dom-examples icon indicating copy to clipboard operation
dom-examples copied to clipboard

to-do-notifications: Not working on Android google chrome

Open im-ghost opened this issue 3 years ago • 14 comments

For some reason the application doesn't seem to work with my browser and also there is no indication that a notification has been enabled

im-ghost avatar Jul 31 '22 21:07 im-ghost

There was a bug (my fault). We fixed it earlier today. Can you double-check it works?

teoli2003 avatar Aug 16 '22 08:08 teoli2003

Some changes seems to have be implemented ,the todo item now get pretended to the body but a notification still wasn't sent. though it asked for notification permission when I clicked the allow notification button ,and I granted it

im-ghost avatar Aug 16 '22 16:08 im-ghost

Thank you, there likely is a second problem. (I suspect the notification API evolved since this has been written). I'll try to dig this out.

teoli2003 avatar Aug 16 '22 16:08 teoli2003

Thank you, there likely is a second problem. (I suspect the notification API evolved since this has been written). I'll try to dig this out.

Will look up to that ,sir

im-ghost avatar Aug 16 '22 16:08 im-ghost

So I got the notification on Firefox: Capture d’écran 2022-08-16 à 18 56 39

On Safari Capture d’écran 2022-08-16 à 19 13 53

It didn't work on Chrome Desktop (though it asked for permission).

(I hope that solving this on Desktop, as we can reproduce the problem there, will fix the problem on Android too)

teoli2003 avatar Aug 16 '22 17:08 teoli2003

Looks likes it is browser compatability issue

im-ghost avatar Aug 16 '22 20:08 im-ghost

I've tried in Chrome with the Native notification flag on and off, no difference. The Notification is not displayed and fail silently.

Also when I add a show event handler, it displays the message as if the notification is shown (which is not):

notification.onshow = () => {
  console.log('Notification shown');
};

I've not found anything on the Web about this. (Difficult to search for Notification API, a lot of noise…)

@jpmedley Could you find somebody who could help us? The code is fairly short and straightforward; a Web Notification API specialist will probably need only a few minutes of their time to understand it. I really would like to have this example work in Chrome (and maybe update our guides on MDN)

teoli2003 avatar Aug 17 '22 05:08 teoli2003

I ran into this a few weeks ago. The problem's not in the code. On mac, notifications need to be turned on at the OS level. I'm still trying to find out why. I'm told that this resets with every system upgrade, but I haven't confirmed this. There is no way to detect this condition in a script.

I'll keep you apprised with updates as I learn them.

image

jpmedley avatar Aug 17 '22 15:08 jpmedley

You can find the code here https://github.com/mdn/dom-examples/tree/main/to-do-notifications

schalkneethling avatar Sep 26 '22 14:09 schalkneethling

I ran into this a few weeks ago. The problem's not in the code. On mac, notifications need to be turned on at the OS level. I'm still trying to find out why. I'm told that this resets with every system upgrade, but I haven't confirmed this. There is no way to detect this condition in a script.

I'll keep you apprised with updates as I learn them.

Thanks

im-ghost avatar Aug 17 '22 22:08 im-ghost

We're having trouble pinning down the precise cause of this. Here's what we think at this point.

Apple has changed its notification API for mac. The old one is still available but deprecated. We think that with the new one, if you decline the first notification request, all notifications are shut off at the os level for Chrome. I recently got a new work mac, so I mentioned that I must have accepted the first Firefox request and that's why notifications work in that app. Apparently it's also possible that Firefox has yet to upgrade to the new mac API. At this point, we just don't know.

@beverloo, please correct this if I've gotten anything wrong.

jpmedley avatar Aug 22 '22 14:08 jpmedley

Thanks for digging into this. These would explain quite a lot of problems.

teoli2003 avatar Aug 22 '22 15:08 teoli2003

We are merging this repository into dom-examples. I will move this issue to dom-examples, so this conversation can continue there.

schalkneethling avatar Sep 26 '22 13:09 schalkneethling

hi folks :) i'm going through some open MDN issues and this one popped up.

my latest understanding of this issue is:

  1. this issue is related to dom-examples/to-do-notifications
  2. this issue was opened because of a problem with this example on Chrome on Android
  3. folks learned that the example didn't work on Chrome on Desktop (on MacOS at least). a possible explanation of this problem is a failure to enable the necessary (and sometimes annoying) OS-level permissions for Chrome, preventing the notification from working at all.

i have a few questions:

  1. i tried this example on Chrome on Android (S22 Ultra) after verifying that both the site and Chrome have notification permissions, and i did not receive the notification - so it appears as though there's still a problem with the application code. does this match others' experiences?
  2. i have tried this example on Chrome on MacOS just now, ensuring that Chrome can show notifications at the OS level, and ensuring that notifications for the demo site are enabled. It worked! CleanShot 2023-10-18 at 12 54 50@2x so - is there still a problem with this example on MacOS Chrome?

if there is still a desire to fix this example on Android/Chrome, this issue should still be active. @teoli2003 - is this something that you would fix?

mentioning all involved: @schalkneethling @teoli2003 @jpmedley @im-ghost

zfox23 avatar Oct 18 '23 17:10 zfox23