I have this problem now, I need to handle the info of push notification when app in backround, I mean, even not tap the notifcation. That mean this application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler must be called in background ! Here is my code for it
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"full message %@", userInfo);
NSDictionary *aps = [userInfo objectForKey:@"aps"];
NSLog(@"full aps %@", aps);
NSString *custom = [userInfo objectForKey:@"custom"];
NSLog(@"full custom %@",custom);
completionHandler(UIBackgroundFetchResultNewData);
[[NSNotificationCenter defaultCenter] postNotificationName:@"notificationRemote" object:nil userInfo:userInfo];
}
I really need handle the info, such that save it to local everytime I have any notification, no matter I tap in push notification.
I search and I saw that I need content-available for my payload, but I can't find it in Firebase Console Notification.