Zend_Mobile_Push_ApnsZend_Mobile_Push_Apns provides the ability to send push notifications to APNS generally in conjunction with Zend_Mobile_Push_Message_Apns; however there is a case when it would not be utilized is when getting feedback from the APNS server. Pushing Messages
When implementing APNS; you have a few components that you will utilize. Zend_Mobile_Push_Apns which contains the server components and Zend_Mobile_Push_Message_Apns which contains the message that you would like to send. Generally when sending push notifications to Apple you should do so in a batch. The actual implementation of the code is fairly minimal; however, considerations to error handling must be taken.
Warning
When sending in batches and you are sending a large amount of push notifications out; you should ensure to usleep from time to time. This will ensure that your messages will be delivered and APNS will not simply hang up on you. Getting FeedbackAPNS has a feedback service that you must listen to. Apple states that they monitor providers to ensure that they are listening to this service. The feedback service simply returns an array of device tokens and the time. You can use the time to ensure that the device has not re-registered for push notifications since the last send.
Advanced MessagesAPNS provides the ability for sending more advanced messages; for instance the examples above show the most basic implementation of a message. Zend_Mobile_Push_Message_Apns allows you to do far more advanced messaging outlined below. AlertsAlerts can contain anything from a simple body message to having an action key and a launch image (iOS 4). You may only want to provide an action key when only a confirmation is necessary OR you are looking to localize the button with non-standard text (aka not "View"). The following code example shows alerts from the » APNS payload examples.
Custom DataYou can send your app custom data which allows you to make decisions based on the notifications; such as synchronizing data.
Warning
You may not use a custom key of 'aps' as it is reserved by Apple and leveraged for the main push data.
|