Last active
August 29, 2015 13:57
-
-
Save marchbold/9798401 to your computer and use it in GitHub Desktop.
Simple example of displaying a local notification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
Notifications.init( APP_KEY ); | |
if (Notifications.isSupported) | |
{ | |
Notifications.service.addEventListener( NotificationEvent.NOTIFICATION_SELECTED, notifications_notificationSelectedHandler, false, 0, true ); | |
// | |
// This will trigger the start up notification if the application was started from a delayed notification | |
// Also this will perform the required registration for notifications permission on iOS 8+ | |
Notifications.service.register(); | |
var notification:Notification = new Notification(); | |
notification.tickerText = "Hello"; | |
notification.title = "My Notification"; | |
notification.body = "Hello World"; | |
Notifications.service.notify( notification.id, notification ); | |
} | |
} | |
catch (e:Error) | |
{ | |
} | |
... | |
function notifications_notificationSelectedHandler( event:NotificationEvent ):void | |
{ | |
} | |
// com.distriqt.Notifications |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for not seeing this comment.
The
APP_KEY
is created through the website:See this tutorial for more information:
More information on this ANE: