Notification center - notification not appearing in notification center when they received on active app
Asked Answered
K

2

6

I need that all notification will apear in notification center , and in my app only the notification received from background or when app is closed is presented in notification center. Is that my problem ? How to add a notification to notification center from code ?

Thanks!

Kellda answered 10/7, 2012 at 8:18 Comment(1)
Does this answer your question? How to make remote notification appear in notification center when app is in the foreground?Stavanger
O
1

You can use postNotification:, postNotificationName:object: or postNotificationName:object:userInfo: methods to post notification from your code

See NSNotificationCenter reference for more informations

Hope it helps!

Opposable answered 10/7, 2012 at 8:22 Comment(1)
I also want same thing . when my app is open i dont want any alert view .just want showing the notification in notification center .please update if any one have solution .Stylo
A
1

Check if application is active when you receive notification

if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)

If active you can show alert or use Local notification to add message in Notification center. Please note user can remove app from Notification Center as well chose alert not banner from settings.

Aramen answered 10/7, 2012 at 8:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.