Home





Local Notifications

Local Notifications are reminders which show up on your screen after the app becomes inactive for a specific amount of time.

// Toggle notification

if(!isNotificationEnabled) {
    Enhance.enableLocalNotification("Game", "Play me!", 60);
    isNotificationEnabled = true;
}

else {
    Enhance.disableLocalNotification();
    isNotificationEnabled = false;
}

Methods

Enhance.enableLocalNotification

void Enhance.enableLocalNotification(
    String title,
    String message,
    int delaySeconds
)

Schedule a new local notification, if possible. The notification will persist until you disable it manually. For example, if you set a notification for 60 seconds, it will invoke this notification 60 seconds after the app is closed, every time.

Parameters:

String  title - Title (header) of the notification.

String  message - Message (body) of the notification.

int  delaySeconds - Delay of the notification (how long to wait after app becomes inactive). Use seconds.

Enhance.disableLocalNotification

void Enhance.disableLocalNotification()

Disable any local notification that was previously enabled.