Can handler not show remote notification when iOS app is killed?
Yes, it's correct.
You cannot catch a remote notification and hide it. The best way to not receive remote notifications is to say no to the permission. If your server send remote notifications you can configure it not to send notifications when you does not want.
Another way to send notifications and not show them is to send "silent notification". It allows you to receive the notification, get its content and do what you want (you have only 30s). I thinks, you can send silent notifications, check content and send a local notification if it needs to, but I'm not sure.
Do not display a remote notification based on custom data
Instead I recommend filtering on your server as sending a notification to all devices (just to omit them from being displayed) has down sides including; extra battery drain and content-available
notifications do not work when the user swipes away the app.
You can use mutable-content
instead which will fire your UNNotificationServiceExtension
but this only works on iOS 10 and you still need to take battery into consideration.
You can get the device's OneSignal player id by calling IdsAvailable where you can store this on your back end. Then you can then use include_player_ids
on the create notification REST API call to target only the users who should receive the notification.
Related Topics
Set<Nsobject>' Does Not Have a Member Named 'Anyobject." - Xcode 6.3
Swift Put Multiple Iboutlets in an Array
Apple Push Notification in Background Issue
iOS 7 When Rotating View in Tab Bar, Right Side of View Is Not Clickable
Type 'String.Index' Does Not Conform Protocol 'Integerliteralconvertible'
How to Create the Current Date (Or Any Date) as an Nsdate Without Hours, Minutes and Seconds
Uitableviewcell Textlabel Color Not Changing
Nsurlsession Delegates Not Called
Expected Declaration Error Creating Array in Viewcontroller, Can't Work Out Why
Nsdateformatter Returns Nil in Swift and iOS Sdk 8.0
How to Programmatically Get iOS's Alphanumeric Version String
Itms-90809: Deprecated API Usage - Existing App That Use Uiwebview Are No Longer Accepted
How to Ensure to Run Some Code on Same Background Thread
Will Push Notification Still Work After Ownership Transfer in Itunesconnect
Apple Push Notification Service Server Certificate Update
Objective-C Rabbitmq Client Not Publishing Messages to Queue
Can the -Objc Flag Be Applied Selectively to Static Libraries