Functions and constants for interacting with local, as well as Apple's and Google's push notification services.
Static methods
staticcancel(id:Int):Void
Cancel a scheduled local push notification.
Use this function to cancel a previously scheduled local push notification. The
notification is identified by a numeric id as returned by Push.schedule
.
Parameters:
id | the numeric id of the local push notification |
---|
staticget_all_scheduled():Table<Int, PushData>
Retrieve data on all scheduled local push notifications.
Returns a table with all data associated with all scheduled local push notifications.
The table contains key, value pairs where the key is the push notification id and the
value is a table with the notification data, corresponding to the data given by
Push.get_scheduled
.
Returns:
data table with all data associated with all scheduled notifications
staticget_scheduled(id:Int):PushData
Retrieve data on a scheduled local push notification.
Returns a table with all data associated with a specified local push notification.
The notification is identified by a numeric id as returned by Push.schedule
.
Parameters:
id | the numeric id of the local push notification |
---|
Returns:
data table with all data associated with the notification
staticregister<T>(notifications:Null<Table<Int, PushNotificationType>>, callback:(T, String, {error:String}) ‑> Void):Void
Register for push notifications.
Send a request for push notifications. Note that the notifications table parameter is iOS only and will be ignored on Android.
Parameters:
notifications | the types of notifications to listen to. (iOS only) |
---|---|
callback | register callback function (function) |
staticschedule(time:Float, title:String, alert:String, payload:String, notification_settings:PushNotificationSettings):PushScheduleResult
Schedule a local push notification to be triggered at a specific time in the future.
Local push notifications are scheduled with this function.
The returned id
value is uniquely identifying the scheduled notification
and can be stored for later reference.
Parameters:
time | number of seconds into the future until the notification should be triggered |
---|---|
title | localized title to be displayed to the user if the application is not running |
alert | localized body message of the notification to be displayed to the user if the application is not running |
payload | JSON string to be passed to the registered listener function |
notification_settings | table with notification and platform specific fields |
staticset_badge_count(count:Int):Void
Set the badge count for application icon. NOTE: This function is only available on iOS.
Parameters:
count | badge count |
---|
staticset_listener<T>(listener:(T, Table<String, Dynamic>, PushOrigin, Bool) ‑> Void):Void
Set push listener.
The listener callback has the following signature: function(self, payload, origin, activated) where payload is a table with the push payload, origin is either ORIGIN_LOCAL or ORIGIN_REMOTE, and activated is either true or false depending on if the application was activated via the notification.
Parameters:
listener | listener callback function |
---|