Skip to content
patrickkulling edited this page Oct 1, 2011 · 6 revisions

API Examples - Notification class

All you need to send a simple notification to the device is to create a new Notification instance and call the notify() method.

notify(title : String, message : String, notificationID : uint = 1, notificationDefaults : NotificationDefaults = null, iconName : String = "icon") : void

Send a notification to the device os with a title and a message and the application icon.

var notification : Notification = new Notification();
notification.notify("Important", "Daily Standup in 10 minutes.");

optional

  • notificationID
  • notificationDefaults
  • iconName

If you want to override a previous notification, pass in the same notificationID. If you want to create new notifications for each time you send a notification, increase the notificationID value.

noticationDefaults is a Vector of NotifactionDefault constants. You can add different NotificationDefault values to the vector, e.g. if you want to let your device play a sound and/or vibrate when a notification was sent.

var notificationDefaults : NotificationDefaults = new NotificationDefaults();
notificationDefaults.addNotificationDefault(NotificationDefault.DEFAULT_VIBRATE);
notificationDefaults.addNotificationDefault(NotificationDefault.DEFAULT_SOUND);

Instead of using the application icon you are able to provide another iconName. Therefore you need to add your icons into the Extension_Android_Notification/res/drawable-* folders, providing the correct size and rebuild the whole application with the provided FDT SWC Library launchers or the ANT build file.

Don't forget to pass the name of your custom icon in the notify() method.

dispose() : void

Call this function if you don't need the class anymore to free your memory.

Clone this wiki locally