Packagecom.myflashlab.air.extensions.localNotifi
Classpublic class Notification
InheritanceNotification Inheritance Object

Notification ANE lets you create local notifications to be fired at a specific time on both Android and iOS. Based on your app status, the behavior of these notifications varies.

If your app is in foreground, the notification will be delivered to you in form of an event. You need to listen to this event NotificationEvents.NOTIFICATION_INVOKED to be notified. If your app is running in background or if it is killed and not running, a notification will be sent to your status bar. If you click on the notification, your app will be opened.

Every notification may hold a payload data which you would have set that at the time of scheduling the notification. When the notification is fired, you can have access to the payload data through the e.payload argument of the NOTIFICATION_INVOKED event.



Public Properties
 PropertyDefined By
  listener : EventDispatcher
[static] [read-only] Use this property to listen to the events being dispatched by this ANE.
Notification
Public Methods
 MethodDefined By
  
[static] Adjust a time for your notification to be fired based on the settings you pass to this method.
Notification
  
dismissAll():void
[static] Dismiss any notification available in the status bar related to this application.
Notification
  
init():void
[static] Call this method to initialize the ANE in your project.
Notification
  
[static] (Android) Notification channels are needed on Android 8+ only.
Notification
  
unset($alarmId:int):void
[static] Use this method to unset a previously adjusted notification schedule by passing its alarm id being returned from the Notification.adjust method.
Notification
  
unsetAll():void
[static] Unset all the notification schedules before they happen.
Notification
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.localNotification
[static]
Notification
  VERSION : String = 3.0.0
[static]
Notification
Property Detail
listenerproperty
listener:EventDispatcher  [read-only]

Use this property to listen to the events being dispatched by this ANE.


Implementation
    public static function get listener():EventDispatcher
Method Detail
adjust()method
public static function adjust($settings:NotificationSettings):int

Adjust a time for your notification to be fired based on the settings you pass to this method. If you are on iOS, you must create an instance of NotificationIosSettings. But if you are on Android, you must use NotificationAndroidSettings

Parameters

$settings:NotificationSettings

Returns
int — an id is returned which must be used when you want to unset a notification before it happens. On iOS, this id will be equal to the setting.notificationId which you have set while configuring the notification. But on Android, this id is different. To make sure you are doing it correctly, always use this returned id to unset a notification before it happens.
dismissAll()method 
public static function dismissAll():void

Dismiss any notification available in the status bar related to this application.

init()method 
public static function init():void

Call this method to initialize the ANE in your project. On iOS, as soon as you call this method for the first time in your app, a dialog opens and asks for user permission to send notifications. This dialog might not open if your app has already asked this question from the user.

registerChannel()method 
public static function registerChannel($channel:NotificationChannel):void

(Android) Notification channels are needed on Android 8+ only. You need to create one or more channels for notifications in your app and then pass the channel instance to this method to register it. From now on, whenever you wish to construct a new notification with an instance of NotificationAndroidSettings, you should also set the channelId property. setting.channelId = "myChannelId";

Parameters

$channel:NotificationChannel

unset()method 
public static function unset($alarmId:int):void

Use this method to unset a previously adjusted notification schedule by passing its alarm id being returned from the Notification.adjust method.

Parameters

$alarmId:int

unsetAll()method 
public static function unsetAll():void

Unset all the notification schedules before they happen.

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.localNotification

VERSIONConstant 
public static const VERSION:String = 3.0.0