Sometimes, you may want to use a Silent Push Notification to update content inside you app in the background. A silent push notification is defined as a push that does not have an alert, badge or sound, and just has Key-Value data.

There are two ways to do this via Sailthru Mobile. The most common will be via our API.

Here's an example of a silent push, sent to everyone. Refer to to the notifications API docs for more

curl -X POST -u :API_KEY -H "Content-type: application/json" -H 'Accept: application/json' https://api.carnivalmobile.com/v3/notifications -d '{
  "notification": {
    "to": ["*"],
    "payload": {
      "content_available": 1, // Wakes up iOS in the background (ignored on Android)
      "any_key": "any_value" //Arbitary keys/values.
    }
  }
}'

iOS

Firstly, you need to enable Remote Notification in your capabilities screen. This is found by clicking your Target in Xcode, and then selecting Capabilities.

15101510

Make sure this is selected to receive notifications in the background.

Next, you must implement application:didReceiveRemoteNotification:fetchCompletionHandler to handle the push.

🚧

App must be in the background

To receive this callback, your app must be in the background. If the app has been swiped out of memory, or your phone has recently been rebooted, you will not receive this callback.

Android

To perform a similar action on Android, refer to Android Custom Notification Handling.