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!
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With