Example Setup

The below examples will demonstrate one way of making use of this plugin.

It is split up into 4 sections, requesting permissions, creating a notification channel, building up a basic notification and notifying your user.

Example Permission Setup

In the below example, we are using various permission nodes to request the Notification runtime permission from the user.

You can see we first identify whether or not we already have permission and only act when we dont.
We then identify whether or not we should display a Permission Rationale, describing why we need this permission.

In the event we do need to display a rationale, we have a placeholder function which should be created by you to describe this rationale to the user and once done, finally request the notification permission.

Example Channel Creation

In the below example, we are using various channel creation nodes to check and create a channel if it does not exist.

Firstly, we fetch all the channels and check to see if our channel is present. In the event you have multiple channels, you may wish to use this example as a base and implement your own to perform that kind of check.

In the event our channel does not exist, we build the channel, check for any errors when building and handle them appropriately.
We then save the notification channel we have built.

Example Notification Building

In the below example, we are using only a few notification creation nodes to build a notification to demonstrate one way this can be done.

Firstly we build a notification with an id of 1234. After this, we check if any errors have occurred, and handle them appropriately.
The way we have demonstrated chaining the nodes together along with error checking can be improved and handled differently.

We finally set the notification small icon and its color and we can now use this notification to notify clients as demonstrated further down.

Example Notification Distribution

In the below example, we are using some of the notification distribution nodes to notify immediatly, schedule a notification at a specific date and schedule a notification to be sent after a delay.

The first notifies the notification we have built immediatly.
The second schedules the notification to be delivered on the 14th of May 2024 at 5:30pm.
The final one schedules the notification to be delivered after 5 seconds.