Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
https://docs.zendframework.com/
Zend_Mobile_Push_Mpns - Zend_Mobile_Push
Zend_Mobile_Push_Mpns provides the ability to send push notifications to Windows Phone. MPNS allows the sending of 3 different types of notifications; which common behavior is in the Zend_Mobile_Push_Message_Mpns base. Followed by specific classes for Raw, Toast and Tile notifications.
Note: Prior to pushing messages; you must implement the practices outlined on » Receiving Push Notifications for Windows Phone.
When implementing MPNS; you have several components that you will utilize. Zend_Mobile_Push_Mpns which contains the server components and Zend_Mobile_Push_Message_Mpns_Raw which allows you to send » raw notifications, Zend_Mobile_Push_Message_Mpns_Toast which allows you to send » toast notifications, and Zend_Mobile_Push_Message_Mpns_Tile which allows you to send » tile notifications. Each message sent must do an HTTP request; so remember this when sending in large batches.
The actual implementation of the code is fairly minimal; however, considerations to error handling must be taken.
Exception | Meaning | Handling |
---|---|---|
Zend_Mobile_Push_Exception | These types of exceptions are more generic in nature and are thrown either from MPNS or internally on input validation | Read the message and determine remediation steps. |
Zend_Mobile_Push_Exception_DeviceQuotaExceeded | You have sent too many messages to this device; you may retry again later. | Try again later or implement » Exponential Backoff . |
Zend_Mobile_Push_Exception_InvalidPayload | Generally the payload will not throw an exception unless the size of the payload is too large or it is missing required content. | Check the size of the payload is within the requirements of MPNS |
Zend_Mobile_Push_Exception_InvalidToken | Any form of an invalid token will be if the device is no longer subscribed, inactive or not valid. | In some cases you may attempt to resend in an hour; this will be stated in the exception. Otherwise you will want to remove the token from being sent to again. |
Zend_Mobile_Push_Exception_QuotaExceeded | You have reached the per-day throttling. | Per-day throttling is only on unauthenticated web services; you will need to » register your application for notifications. |
MPNS 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_Mpns_* allows you to do far more advanced messaging outlined below.
Tile messages have additional optional attributes for Windows Phone 7.1+; you must ensure that you are sending to a device with the proper version otherwise your notification will fail.
Toast messages have additional optional attributes for Windows Phone 7.1+; you must ensure that you are sending to a device with the proper version otherwise your notification will fail.