Posts

Showing posts with the label apple-push-notifications

Push notification is not working when app is in background (minimized) - IOS

Image
Clash Royale CLAN TAG #URR8PPP Push notification is not working when app is in background (minimized) - IOS I'm newbie to Swift, i am creating chat application, i need to send notification when app is in foreground or minimized. but i am not getting the notification when app is minimized (it works when USB is connected. func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { Messaging.messaging().appDidReceiveMessage(userInfo) let action = userInfo["action"] as! String let notification = UILocalNotification() notification.fireDate = NSDate() as Date notification.alertTitle = "test" notification.alertBody = "test" notification.alertAction = "Ok" UIApplication.shared.applicationIconBadgeNumber = 1 UIApplication.shared.scheduleLocalNotification(notification) completi...