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


isPermitted()

Returns whether or not the permission has been granted

Returns: boolean


isSupported()

Returns whether or not the Web Notification functionality is supported

Returns: boolean


requestPermission(callbackMethod)

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

Parameters:

  • {function} callbackMethod CallbackMethod

Returns: boolean


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

Shows a notification

Parameters:

  • {string} title Title

  • {string} body Body

  • {media} [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