Web Notifications (Native)

(part of package 'Web Notifications')

You can access it in code via: plugins.webnotificationsNative

API

getPermission()

Returns the current permission value as defined by the Web Notifications API. It can contain the following values: - default: implicitly denied - denied: explicitly denied - granted: explicitly granted

Returns: String The current permission status for Web Notifications ('default', 'denied', or 'granted').


isPermitted()

Returns whether or not the permission has been granted

Returns: Boolean True if permission for Web Notifications has been granted; otherwise, false.


isSupported()

Returns whether or not the Web Notification functionality is supported

Returns: Boolean True if Web Notification functionality is supported; otherwise, false.


requestPermission(callbackMethod)

Requests permission to the user and executes the callback method when done

Parameters:

  • {Function} callbackMethod A function that will be executed once the user has granted or denied permission.

Returns: Boolean True if the permission request was successfully initiated; otherwise, false.


show(title,body,icon,image,tag,onClickCallbackMethod)

Shows a notification

Parameters:

  • {String} title The title of the notification.

  • {String} body The body text of the notification.

  • {String} [icon] URL to an icon image

  • {String} [image] URL to a body image

  • {String} [tag] Unique identifier for the notification, will be generated if not supplied

  • {Function} [onClickCallbackMethod] This method will be called if the user clicks on the notification and will pass the tag as an argument

Returns: String Value of the tag (as supplied or generated)



Last updated

Was this helpful?