Reputation: 307
I am new to iphone Programming . I am using localNotification in my application.It is giving alert to user and responding to Launch using didReceiveLocalNotification.But my problem is if user close the UILocalNotification in my Application i need to execute database operation .So how can i do that .Is there any approach for that one.
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
NSDate* now = [NSDate date];
[localNotification setFireDate:now];
localNotification.soundName=@"Tink.wav";
[localNotification setAlertAction:@"Launch"];
[localNotification setAlertBody:@"You have entered to Your Place:"];
[localNotification setHasAction: YES];
NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"obj" forKey:kRemindMeNotificationDataKey];
localNotification.userInfo = userDict;
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
NSLog(@"Recieved Notification");
NSString *DateString=[notif.userInfo valueForKey:kRemindMeNotificationDataKey];
if([DateString isEqualToString:@"obj"])
{
[[UIApplication sharedApplication] cancelLocalNotification:notif];
}
NSString *strNotif=[notif.userInfo objectForKey:kRemindMeNotificationDataKey];
if ([strNotif isEqualToString:@"obj"]) {
UIAlertView *alretCheck=[[UIAlertView alloc]initWithTitle:@"notifi Testing in DidRec+" message:strNotif delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alretCheck show];
[alretCheck release];
}
Thanking you in advance.
Upvotes: 0
Views: 278
Reputation: 2514
Now Acc. to my Knowledge we cannot do that what you want. we only have command on the "View" Option of LocalNotification Alert. But if possible u can do one thing onClick on "View" button u can Show an ActionSheet or another alert and on those buttons you can handle all the event you want.
Upvotes: 3