I am new to push notification and I managed to get the push notification working. And now whenever a push notification comes and if I press it, the app will open and goes a page.
This is my push notification message
{"to":"eHPnnkSDzWk:APA91bHs...","data":{"message":"test notification","type":"5"}}
and these are the types
Gallery ( Type = 1 )
Messenger ( Type = 4 )
Events ( Type = 5 )
News ( Type = 6 )
This is currently my didReceiveRemoteNotification function
func application(_ application: UIApplication, didReceiveRemoteNotification
userInfo: [AnyHashable: Any],fetchCompletionHandler completionHandler: @escaping
(UIBackgroundFetchResult) -> Void) {
if let messageID = userInfo[gcmMessageIDKey] {
print("Message ID: \(messageID)")
}
print(userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}
Here is my question , how can I fetch this TYPE from the push notification and then open a specific page on the app when user clicks on the push notification?
(sorry if this sounds silly, but this is my first time trying to do this, I tried looking around but couldn't find any proper answer)
userInfo
dictionary.