7

I am using OneSignal and want to be able to detect current subscribtion state between those three:

  • user is blocking notifications
  • not subscribed
  • subscribed

OneSignal API gives the isPushNotificationsEnabled function, but it only detects two states: pushes allowed or not.

I wonder if there's more general (outside of OneSignal API) method to detect that, at least in some browsers.

I Hafid
  • 373
  • 2
  • 13

1 Answers1

12

Solution turned out to be Notification.permission, which takes three states:

  • default
  • granted
  • denied

And that's exactly what I needed.

I Hafid
  • 373
  • 2
  • 13