HOW TO NAVIGATE THROUGH NOTIFICATION

Steven Hill

Total Post:10

Points:72
Posted by  Steven Hill
 653  View(s)
Ratings:
Rate this:
I want to navigate on specific screen on tapping notification,
I tried by using alert key but it will not work after closing application.
Please help me.
  1. Tarun Kumar

    Post:214

    Points:1642
    Re: How to navigate through notification

    If you want to navigate on another app through the notification, use these methods didFinishLaunchingWithOptions: , didReceiveRemoteNotification: from your app delegate; use this example:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
                                                     (NSDictionary *)launchOptions {
       self.window.rootViewController = self.tabBarController;
       [self.window makeKeyAndVisible];

       // If application is launched due to  notification, present another view controller.
       UILocalNotification *notification = [launchOptions objectForKey:
                                            UIApplicationLaunchOptionsRemoteNotificationKey];
       if(notification) {
          NotificationViewController *viewController = [
                                            [NotificationViewController alloc]initWithNibName:
                                             NSStringFromClass([NotificationViewController class])
                                             bundle:nil];
          [self.window.rootViewController presentModalViewController:
                                             viewController animated:NO];
          [viewController release];
       }
       return YES;
    }

     -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    NotificationViewController *viewController = [[NotificationViewController alloc]initWithNibName:NSStringFromClass([NotificationViewController class]) bundle:nil];
       [self.window.rootViewController presentModalViewController:viewController animated:NO];
       [viewController release];
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!