Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do notifications show on Chrome on Android?

Consider the following.

if (this.Notification) {
  Notification.requestPermission(function(permission) {
    if (permission === 'granted') {
      return new Notification('hi this is a test');
    } else {
      return alert("Notifications not permitted");
    }
  });
} else {
  alert('Notifications not supported');
}

JSFiddle.

This seems to behave as expected in Chrome on desktop. In Firefox for Android, such notifications appear in the Android notification bar.

However on Android Chrome it seems to prompt the user to allow/disallow notifications, but if the user clicks 'allow' nothing seems to happen. Does Android Chrome support this sort of notification?

EDIT: This is different to this question from 18 months ago - then window.Notification wasn't defined at all. Now it is defined but doesn't seem to do anything.

like image 417
George Simms Avatar asked Aug 01 '15 23:08

George Simms


1 Answers

I think this is a duplicate with the following question HTML5 Notification not working in Mobile Chrome. When I debug it on my Android device, I get the following error:

Failed to construct 'Notification': Illegal constructor. Use ServiceWorkerRegistration.showNotification()

like image 196
Swimburger Avatar answered Sep 21 '22 14:09

Swimburger