ios - Detect if the app was launched/opened from a push notification -


is possible know if app launched/opened push notification?

i guess launching event can caught here:

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      if (launchoptions != nil) {          // launched push notification          nsdictionary *notification = [launchoptions objectforkey:uiapplicationlaunchoptionsremotenotificationkey];      } } 

however, how can detect opened push notification when app in background?

see code :

- (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo {     if ( application.applicationstate == uiapplicationstateinactive || application.applicationstate == uiapplicationstatebackground  )     {          //opened push notification when app on background     } } 

same

-(void)application:(uiapplication *)application didreceivelocalnotification (uilocalnotification *)notification 

Comments