func application(application: UIApplication, didReceiveRemoteNotification data: [NSObject : AnyObject]) {
var dat = JSON(data)
if application.applicationState == UIApplicationState.Active {
// app was already in the foreground
println("App is in foreground")
processNotification(dat)
}else{
// app was just brought from background to foreground via PUSH
println("App brought back via PUSH")
processNotification(dat)
}
}
This is how I check for push notifications. However, when if I send a push notification, the user misses it, and then opens the app via the icon? How can I check when the app was opened from the icon?