Acknowledging the receipt of a push message

The server-side push initiator can send a confirmed push message with application-level reliability. The client-side push-enabled app must acknowledge a confirmed push message. The client-side app can determine whether it received a confirmed push message by checking the Boolean field isAcknowledgeRequired from the PushPayload object. If the property is set to true, the client-side app must acknowledge the push message by either accepting it by calling pushpayload.acknowledge(true) or rejecting it by calling pushpayload.acknowledge(false). For more information about these functions, see the API Reference.

The sample app checks the isAcknowledgeRequired field when it calls pushNotificationHandler(). The sample app acknowledges the receipt of the push message by accepting it by calling pushpayload.acknowledge(true).

// If an acknowledgement of the push is required (that is, the push
// was sent as a confirmed push), then your app must either accept 
// or reject the push. A confirmed push is equivalent terminology to
// the push being sent with application-level reliability.
if (pushpayload.isAcknowledgeRequired) {
   // The sample app always accepts the push, but there might be 
   // cases when you want your app to reject the push. For   
   // example, after looking at the headers that came with the push   
   // or the data of the push, your app might decide that the push 
   // received did not match what it expected, and so it might 
   // reject the push.

Last modified: 2015-06-11

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus