Background/Data notifications are "silent" meaning they do not display any message or play a sound when received by your app. They are designed to keep your app's data "up-to-date" by providing a way to "wake up" the app to refresh the data in the background.
Background/Data Notification Limitations
If you force close the app, it cannot receive background/data notifications.
Limited Support for Non-Native SDKs
If you are using a non-native SDK like Unity, React Native, Cordova, or Flutter, you must use native Java/Kotlin or Swift/Objective-C to implement Data Push Notifications.
iOS will need to implement a special delegate. You can learn more at the bottom of Handling Remote Notifications.
For Android, you will need to implement the NotificationExtenderService.
Setting up and sending background notifications in iOS requires 3 components:
You must not send a message (no
contents) and you must send
content_available to wake the app if it is running in the background.
Native iOS Apps: Process the data within the Notification Received Handler while the app is running in the foreground or background.
Non-Native iOS Apps: Process data within the Native iOS API within the
iOS Force Quit Limitations
Apple does not allow the processing of background data if the App has been swiped away.
If the app has been swiped away, you will need to add
contents(a message) to the push (cannot be a background message) and handle the data within the UNNotificationServiceExtension.didReceive method.
There is no way to process a background notification when the app has been force quit.
The OneSignal SDK is set up to only send data notifications to subscribed devices. If you want to target unsubscribed devices with data notifications, you will need to follow this workaround.
Data notifications are handled within the NotificationExtenderService - This can be set up to receive data notifications when your app is not running, or to override how notifications are shown in the notification shade.
OneSignal will automatically send the notification as a data notification under the following notification parameter conditions:
OneSignal supports VoIP notifications for iOS. Our SDKs do not support registration for a VoIP token at this time.
See our VoIP Notifications Setup Guide to get started.
Do Confirmed Deliveries work with Silent Push Notifications?
On iOS, unfortunately this is not possible right now.
While we use the NotificationServiceExtension to send the confirmed delivery, iOS will not trigger the NSE if you do not add a message to the body of the push. It is also not possible to work around this by setting a body then making it nil or blank in the NSE. If you try to do that iOS puts back the body and displays it. You can't prevent a notification from showing with the NSE either.
Updated 5 months ago