LocalNotification


Purpose

A LocalNotification object specifies a notification that the Pega Mobile Client application can schedule for presentation at a specific time. The device's operating system is responsible for delivering local notifications at their scheduled times. Therefore, the application does not have to be running for this to happen. Local notifications do not require a connection to remote servers. They are intended for use by applications with timer-based behaviors, but an application that is running in the background can also schedule a local notification to inform the user of an incoming event.

Note

To avoid an error when scheduling a local notification, do not set the fireDate and repeatInterval attributes at the same time.

If you plan to deploy the application only on iOS 10 devices, you can set the repeatInterval attribute to any value greater than 60. When deploying on iOS 9 devices, you are limited to the constant values listed in the Interval enum below.

Module

This object belongs to the Notifications product module.

Constructor

An instance of the LocalNotification object can be obtained using the following definition.

[Constructor(identifier: String, title: String, message: String)]  
interface LocalNotification {  

  // Predefined repeat intervals in seconds, necessary for iOS. On Android they can be used as helper constants.  
  enum Interval {  
    NO_REPEAT = 0,  
    MINUTE    = 60,  
    HOUR      = 60*60,  
    DAY       = 60*60*24,  
    MONTH     = 60*60*24*30,  
    YEAR      = 60*60*24*365  
  }  

  // A unique identifier of the notification (required).  
  attribute readonly identifier: String  

  // The notification title (required).  
  attribute readonly title: String  

  // The notification message (required).  
  attribute readonly message: String  

  // Specifies the time when the notification should be delivered.  
  // If undefined or a date in the past is passed, the notification will be handled immediately.  
  attribute fireDate: Date  

  // A badge to be shown on the iOS app icon. Passing 0 (the default value) clears the badge.  
  // Badges are shared with push notifications.  
  attribute badge: Number  

  // The name of a sound file to be played (incl. file extension).  
  // The string 'default' should be passed for the default system alert sound (it's not the sound that user selected in phone settings).  
  // The default value of this parameter is undefined, i.e. no sound is played.  
  // See customization guide for packaging custom alert sounds.  
  attribute soundName: String  

  // A time interval in seconds at which the notification will be rescheduled by the operating system.  
  // Default value is 0, which means the system fires the notification once and then discards it.  
  // On iOS 9.x, the repeatInterval must be one of the predefined Interval constants (mapped to native constants).
  // On iOS 10 the repeatInterval can be any value greater than 60.
  attribute repeatInterval: Number  

  // The identifier of the group of actions (NotificationCategory) to display in the notification banner.  
  attribute category: String  
}

Related topics

Notifications
Legal notice | Copyright © 2017 and Confidential to Pegasystems Inc. All rights reserved
PDN | Feedback
Advanced...