-(void)applicationDidEnterBackground:(UIApplication *)application
{
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
// Current date
NSDate *date = [NSDate date];
// Add interval to the current time
NSDate *dateToOpen = [date dateByAddingTimeInterval:timeInterval];
// Set the fire date/time
[localNotification setFireDate:dateToOpen];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
// Setup alert notification
[localNotification setAlertBody:@"Tap to return to MyApp" ];
[localNotification setAlertAction:@"Open MyApp"];
[localNotification setHasAction:YES];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
{
UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
// Current date
NSDate *date = [NSDate date];
// Add interval to the current time
NSDate *dateToOpen = [date dateByAddingTimeInterval:timeInterval];
// Set the fire date/time
[localNotification setFireDate:dateToOpen];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
// Setup alert notification
[localNotification setAlertBody:@"Tap to return to MyApp" ];
[localNotification setAlertAction:@"Open MyApp"];
[localNotification setHasAction:YES];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
No comments:
Post a Comment