1

Is there a way to post and show local notifications in the foreground? If not, is there a way to "fake it"? I need to make an iOS appear like an Android app, which does have notifications in the foreground.

Marc Estrada
  • 1,657
  • 10
  • 20
ndk
  • 327
  • 2
  • 6

1 Answers1

3

For iOS 10 and next you can use UNUserNotificationCenterDelegate and see this post for more information. If you app run on 8 or 9 ios you should use 3d party libs (you can search)

Sample: Add it to your delegate methods in the AppDelegate and conform to this protocol - UNUserNotificationCenterDelegate

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
     completionHandler([.alert,.badge])
}
RrrangeTop
  • 312
  • 1
  • 10