Skip to main content

bfgLocalNotificationManager Class

Provides a straightforward interface for scheduling and cancelling local notifications. The class enables standardized management of local notifications that can survive a restart of the device. More...

Static Public Member Functions

static void cancelNotification (long notificationId)
 Cancel a pending or already-published notification. More...
 
static long scheduleNotification (string title, string content, int iconResourceId, long replaceNotificationId, long epochTimeInMilliseconds, bool autoDismiss)
 Schedules a new notification with an explicit identifier. The method may also cancel a pending or already-published notification. More...
 
static long scheduleNotification (string title, string content, int iconResourceId, long epochTimeInMilliseconds, bool autoDismiss)
 Schedules a new notification with an explicit identifier. The method may also cancel a pending or already-published notification. More...
 

Detailed Description

Provides a straightforward interface for scheduling and cancelling local notifications. The class enables standardized management of local notifications that can survive a restart of the device. How local notifications work: Use scheduleNotification to request submission of a new notification at a specified time. The method may also be used to cancel a pending or published notification in favor of a newly-scheduled notification.
Warning
Android only.
Use cancelNotification to cancel submission of a pending notification or to remove an already-published notification.

Member Function Documentation

◆ cancelNotification()

static void BFGSDK.bfgLocalNotificationManager.cancelNotification (long notificationId)
inlinestatic
Cancel a pending or already-published notification. Immediately cancel the notification identified by the argument. If the notification is pending (i.e., scheduled, but not yet published), then publication will be cancelled. If the notification has already been published, then it will be removed from the notification tray.
Parameters
notificationIdA value of type long that uniquely identifies the notification. It may have been assigned in a prior call to scheduleNotification (value passed for replaceNotificationId) or returned by a prior call to scheduleNotification.

◆ scheduleNotification() [1/2]

static long BFGSDK.bfgLocalNotificationManager.scheduleNotification (string title,
string content,
int iconResourceId,
long epochTimeInMilliseconds,
bool autoDismiss 
)
inlinestatic
Schedules a new notification with an explicit identifier. The method may also cancel a pending or already-published notification. Schedule a notification for publication at a specific time. The replaceNotificationId argument may be used to cancel a pending publication or to remove a notification that has already been published. The remaining arguments describe the appearance of the notification and an Android intent to be executed when the notification is tapped.
Parameters
titleA string value specifying the notification's title.
contentA string value specifying the text content of the notification.
iconResourceIdAn integer resource ID identifying the icon to use in the notification display. Note that this argument is required and that it must identify a valid "drawable" icon.
epochTimeInMillisecondsThis determines the time at which the notification will be published. It is specified as "epoch time"; i.e., UTC time in milliseconds since 00h00:00 January 1, 1970. For example, use (System.currentTimeMillis() + 300000) to schedule a notification for 5 minutes in the future.
autoDismissThis argument determines whether the notification will be removed from the notification tray automatically when the user taps the notification. Note that the argument will be ignored unless a non-null Intent is provided for the intent argument.
Returns
An integer value (Java type long) that uniquely identifies the scheduled notification. It may be used in cancelNotification or a subsequent call to scheduleNotification (replaceNotificationId argument) to cancel or replace the notification.

◆ scheduleNotification() [2/2]

static long BFGSDK.bfgLocalNotificationManager.scheduleNotification (string title,
string content,
int iconResourceId,
long replaceNotificationId,
long epochTimeInMilliseconds,
bool autoDismiss 
)
inlinestatic
Schedules a new notification with an explicit identifier. The method may also cancel a pending or already-published notification. Schedule a notification for publication at a specific time. The replaceNotificationId argument may be used to cancel a pending publication or to remove a notification that has already been published. The remaining arguments describe the appearance of the notification and an Android intent to be executed when the notification is tapped.
Parameters
titleA string value specifying the notification's title.
contentA string value specifying the text content of the notification.
iconResourceIdAn integer resource ID identifying the icon to use in the notification display. Note that this argument is required and that it must identify a valid "drawable" icon.
replaceNotificationIdAn integer identifier value assigned to the notification. If this ID is used in a subsequent call to scheduleNotification, then the prior notification will be cancelled (if it is still pending) or removed from the notification tray (if it has already been published). Note that, when the method is called without a parameter value for replaceNotificationId, bfgLocalNotificationManager will automatically assign a negative integer identifier. Accordingly, developers may avoid clashes between user-assigned identifiers and SDK-assigned identifiers by using only non-negative integers for the former.
epochTimeInMillisecondsThis determines the time at which the notification will be published. It is specified as "epoch time"; i.e., UTC time in milliseconds since 00h00:00 January 1, 1970. For example, use (System.currentTimeMillis() + 300000) to schedule a notification for 5 minutes in the future.
autoDismissThis argument determines whether the notification will be removed from the notification tray automatically when the user taps the notification. Note that the argument will be ignored unless a non-null Intent is provided for the intent argument.
Returns
An integer value (Java type long) that uniquely identifies the scheduled notification. It may be used in cancelNotification or a subsequent call to scheduleNotification (replaceNotificationId argument) to cancel or replace the notification.