I am using Google Firebase to send notifications to users. At the time I am trying to send notification to single device (mine).
Having a problem with receiving notifications - while my app is running in background banner not appears. But if I open my app, method didReceiveRemoteNotification: triggers my alert view:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:userInfo[@"notification"][@"body"]
message:@"More info..."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Open",nil];
[alert show];
}
But as it's written in Google Firebase documentation, this method triggers after app opens, so it make sense.
So message is delivered to my device, I just can't trigger a notification banner if app is in background.
I read about setting message priority to High and custom data key content-available to 1, but no luck.
Am I missing something else in my code to trigger notification? I have done this with Google Firebase Guide to implement Notifications.