NotificationManager

The NotificationManager item allows scheduling native local push notifications on iOS & Android. More...

Import Statement: import Felgo 3.0
Inherits:

PluginItem

Signals

Methods

Detailed Description

For more information also have a look at Notification Plugin.

Signal Documentation

notificationFired(notificationId)

This handler is called whenever a notification was fired. The provided notificationId parameter describes the fired notification. You can use the parameter to decide further actions in your app, e.g. to display a pop-up or navigate to another screen.

Example:

 NotificationManager {

   onNotificationFired: {
     console.debug("Notification with id", notificationId, "fired")
   }

 }

See also schedule and scheduleNotification.


Method Documentation

void cancelAllNotifications()

Call this function to cancel all currently scheduled notifications for your app.

See also cancelNotification.


void cancelNotification(notificationId)

Call this method to cancel the scheduled notification identified by the given notificationId. The notificationId can either be retrieved from a statically created Notification item or cached from a dynamically scheduled one.

See also cancelAllNotifications.


string schedule(params)

Dynamically schedules a local notification for delivery at a given point of time. The params map parameter expects the keys as in the Notification item. The return value is the notification's notificationId which is either set directly in the notification or randomly created during scheduling.

Example:

 // Trigger notification in 8 seconds
 var notificationId = notificationManager.schedule({ message: "Hi Felgo", number: 1, timeInterval: 8 })

Please also have a look at the Notification Plugin#Example Usage.

See also scheduleNotification and notificationFired.


string scheduleNotification(notification)

Schedules a given Notification item for delivery at a given point of time. The return value is the notification's notificationId which is either set directly in the notification or randomly created during scheduling.

Example:

 Notification {
   id: staticNotification

   notificationId: "static_notification"
   message: "I'm statically defined in the app"
   timeInterval: 10

   Component.onCompleted: {
     // Trigger notification in 10 seconds
     notificationManager.scheduleNotification(staticNotification)
   }
 }

Please also have a look at the Notification Plugin#Example Usage.

See also schedule and notificationFired.