Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper use of "content-available" in iOS 7 Push Notifications

I'm just looking for some feedback on my thought process surrounding iOS 7 and the "content-available" key value in a push notification payload.

Scenario: I force shut down the application. According to Apple because I've done this I will no longer receive any notifications that contain the key value "content-available" in their payload. This means that the alert doesn't show at all, basically nothing happens. No sounds, no alert message, no badge increment.

Theory: Because of the above scenario it seems as if you'd want to send two push notifications.

  1. A push notification with just your "alert","badge" and "sound" values so that the user sees a notification related to the update irregardless of the application state.

  2. A push notification with just the "content-available" key value. If the app is in a state where it can accept this it does and your background task is performed. In the case it can't accept it the user still receives a visual / audible notification from the first push notification.

Question: Is this how Apple intends the silent / background notifications to be executed? I don't really see another way that you could implement this.

like image 245
James Parker Avatar asked Dec 19 '13 19:12

James Parker


1 Answers

I think your thought process is right and the information you have is correct for the current implementation of push notifications in iOS 7.0

However people have been filing bug reports and talking about the fact that forcibly quitting the app makes it ineligible to be woken up by a push notification with "content-available" in the payload (See SO answer). Hopefully Apple will address this in iOS 7.1 or at least update the docs.

like image 172
nvrtd frst Avatar answered Oct 19 '22 20:10

nvrtd frst