Displaying a notification


You can display a notification if you want to notify your user of something important. Let’s say you have a app that displays incomming messages. You could display a notification when a message arrives. It’s easy to set up and you can also add a function, so if a users clicks on the notification, it shows something in the app.

Showing a notification

Let’s start by adding these few lines of code to your project. Also make sure that you’ve copied the ‘com’ folder from the ServConnect SDK to your project’s root folder.

import com.alwinlubbers.ServConnectManagerSDK.Notification;
var testNotifi:Notification = new Notification(communication, "appIcon", "Test notifi", "Here goes your text");

Firstly, you import the Notification class from the SDK by calling import. Next, create a new Notification instance by using var instanceName:Notification = new Notification(…). This will directly trigger the notification inside ServConnect Manager. If you run your app inside ServConnect TestBed with this code, you’ll see the following result:

All class options

These are all the parameters of the Notification class:

Notification(communicationArray:Array, icon:String, title:String, text:String, iconBitmapData:BitmapData = null, isCloseable = true, isOpenable = false, openFunctionName = null, openFunctionParms = null):void

  • communicationArray:Array This is the main communication array of your app, ServConnect Manager uses this array to communicate with your app.
  • icon:String Use “AppIcon” to use the icon of your app or use “custom” to provide a BitmapData to show. 
  • title:String This is the title of the notification.
  • text:String This is the text of the notification.
  • iconBitmapData:BitmapData Only provide a BitmapData if you’ve set the icon to “custom”.
  • isCloseable:Boolean Set to ‘true' to let the user close the notification. If set to ‘false’, the notification will disappear after 5 seconds.
  • isOpenable:Boolean A ‘OPEN’ button will appear inside the notification. If a user clicks it, it will excecute the openFunctionName function with the openFunctionParms parameters.
  • openFunctionName:String The name of the function. This function is called when the user clicks the ‘OPEN’ button inside the notification.
  • openFunctionParms:String These are the parameters to use with the function defined at openFunctionName. Separated by commas.

copyright Alwin Lubbers Software/ContourReclame B.V. 2017-2019