In the application active state, the didReceiveRemoteNotification method is called and when the application is in the background and inactive state the didReceiveRemoteNotification method is not called.
Code:-
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void){
NSLog("Push Received: \(userInfo)")
completionHandler(UIBackgroundFetchResult.newData)
}
didReceiveRemoteNotification
to be called in background? – Gokul G