The APNS class / com.APNS methods |
Decodes content of BYTE data returned from the APNS feedback service.
com.APNS.DecodeFeedback( data BYTE, unregs DYNAMIC ARRAY OF RECORD timestamp INTEGER, deviceToken STRING END RECORD )
Apple recommends to connect frequently to the APNS feedback server in order to verify that your applications are still registered for push notifications.
tcps://feedback.push.apple.com:2196The DecodeFeedback() method decodes the content of the BYTE variable, which was passed as a parameter and received as response for the TCP request to the APNS feedback server.
For the second parameter, this method takes a structured dynamic array that will be filled with the list of unregistered APNS device tokens. It is up to the push program to stop sending push notification messages for these unregistered device tokens.
The timestamp member of an unregs dynamic array element can be used to verify that device tokens have not been re-registered since the feedback entry was generated. This timestamp is returned as a number of seconds since the Unix epoch, in UTC. Use the util.Datetime.fromSecondsSinceEpoch utility API to convert timestamp to a DATETIME value in the current local time.
The deviceToken member of an unregs dynamic array element identifies iOS devices that have been unregistered from the APNS server. Note that these identifier is encoded in Base64.
In the event of a decoding error, the method will raise the exception -15566, with details in the SQLCA.SQLERRM register.
DEFINE feedback_data BYTE, unregs DYNAMIC ARRAY OF RECORD timestamp INTEGER, deviceToken STRING END RECORD, i INTEGER LOCATE feedback_data IN MEMORY ... TCP request to APNS feedback server ... CALL com.APNS.DecodeFeedback(feedback_data, unregs) FOR i=1 TO unregs.getLength() DISPLAY i, " ", unrefs[i].deviceToken END FOR
For a complete example, see APNs feedback handler.