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 enableLocalNotificationWithTitle:@"Game" message:@"Play me!" delay:60];
    isNotificationEnabled = true;
}

else {
    [Enhance disableLocalNotification];
    isNotificationEnabled = false;
}

Methods

Enhance requestLocalNotificationPermission

void [Enhance requestLocalNotificationPermission:
    (id) delegate
]

Request a permission from the user to show local notifications. Parameters:

id delegate - Specifies the callback object. Should implement the PermissionDelegate protocol. (See the Protocols section for more information)

Enhance enableLocalNotificationWithTitle

void [Enhance enableLocalNotificationWithTitle:
    (NSString*) title,
    message:(NSString*) message,
    delay:(int) delay
]

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:

NSString* title - Title (header) of the notification.

NSString* message - Message (body) of the notification.

int delay - 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.

Protocols

protocol PermissionDelegate
-(void)onPermissionGranted;
-(void)onPermissionRefused;