I would like to know if there is a way to know if an app (which can be closed or open in background) has been launched with a click on:
- a notification (in the notification center) ?
- or the app icon on the springboard ?
Thanks !!
I would like to know if there is a way to know if an app (which can be closed or open in background) has been launched with a click on:
Thanks !!
put this code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UILocalNotification *notification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
    if (notification) {
        // launched from notification
    } else {
        // from the springboard
    }
}
in your UIApplicationDelegate.
 
    
    From Apple Docs on Scheduling, Registering, and Handling Notifications :
iOS Note: In iOS, you can determine whether an application is launched as a result of the user tapping the action button or whether the notification was delivered to the already-running application by examining the application state. In the delegate’s implementation of the application:didReceiveRemoteNotification: or application:didReceiveLocalNotification: method, get the value of the applicationState property and evaluate it. If the value is UIApplicationStateInactive, the user tapped the action button; if the value is UIApplicationStateActive, the application was frontmost when it received the notification.
