Question:
Is it possible to send a silent push to a macOS client from an API request or from the Control Panel?
Answer:
There are no “true” silent pushes on macOS — if the app is not running, the push will not be handled. You can, however, imitate a silent push by sending no alert and passing the required parameters in mac_root_params:
"mac_root_params": {
"aps": {
"content-available": 1
}
}
Any other parameter can be used instead of content-available; the only mandatory part is not setting an alert.
On the application side the message arrives in the standard receive callback. In current SDK versions that is PWMessagingDelegate:
func pushwoosh(_ pushwoosh: Pushwoosh, onMessageReceived message: PWMessage) {
// handle the silent payload here
}
The older -[PushNotificationDelegate onPushReceived:withNotification:onStart:] callback still exists but is part of the deprecated PushNotificationManager API and should not be used in new code.
This solution only works while the app is running.
Comments
0 comments
Please sign in to leave a comment.