The purpose of "Content-available" in Push Notification Json?

Nandkishor Chaudhari picture Nandkishor Chaudhari · Jan 5, 2015 · Viewed 26.1k times · Source

The purpose is to send push notification with only badge value & nothing else (no banner).

I integrated parse sdk to test push notification & send this push notification

{
"alert" :"",
"badge" :"787",
"Content-available" : "1",
"sound" : ""
}

So the push notification got send when app is in background, foreground & when app is killed. The purpose to wipe some data on arrival of push notification with badge valve 78 got succeeded. I send same notification with "Content-available" : "1" removed but everything worked fine as earlier.

My understanding on "Content-available" was that putting it's value to 1 will allow push notification with no alert value.

So I am confused or I am missing something to know the meaning of "Content-available" in this push notification JSon.

Thanks

Answer

Midhun MP picture Midhun MP · Jan 5, 2015

If you provide this key with a value of 1, (if user opens you app is in background or resumed) the application:didReceiveRemoteNotification:fetchCompletionHandler: will be called.

According to RemoteNotifications Programming content-available definition is

Provide this key with a value of 1 to indicate that new content is available. Including this key and value means that when your app is launched in the background or resumed, application:didReceiveRemoteNotification:fetchCompletionHandler: is called.

(Newsstand apps are guaranteed to be able to receive at least one push with this key per 24-hour window.)