# Web Notifications (Native)

(part of package '[Web Notifications](https://docs.servoy.com/reference/servoyextensions/packages/browser-plugin-packages/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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) The current permission status for Web Notifications ('default', 'denied', or 'granted').

***

### isPermitted()

Returns whether or not the permission has been granted

**Returns:** [Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/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](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/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](https://docs.servoy.com/servoy-developer/component_and_service_property_types#function)} callbackMethod A function that will be executed once the user has granted or denied permission.

**Returns:** [Boolean](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/boolean) True if the permission request was successfully initiated; otherwise, false.

***

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

Shows a notification

**Parameters:**

> * {[String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)} title The title of the notification.
> * {[String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)} body The body text of the notification.
> * {[String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)} \[icon] URL to an icon image
> * {[String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)} \[image] URL to a body image
> * {[String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string)} \[tag] Unique identifier for the notification, will be generated if not supplied
> * {[Function](https://docs.servoy.com/servoy-developer/component_and_service_property_types#function)} \[onClickCallbackMethod] This method will be called if the user clicks on the notification and will pass the tag as an argument

**Returns:** [String](https://docs.servoy.com/reference/servoycore/dev-api/js-lib/string) Value of the tag (as supplied or generated)

***

***
