Hello Friends, Normally APNS sends notification when app is in foreground with notification , badge and Alert. But When App is in foreground it only delivers notification but not with the sound feature.
For This Add this code in your AppDelegate.m method
For This Add this code in your AppDelegate.m method
- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
//For notification Banner - when app in foreground
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound |UNNotificationPresentationOptionBadge);
// Print Notification info
NSLog(@"Userinfo %@",notification.request.content.userInfo);
}
Thanks
No comments:
Post a Comment