Software Engineering Manager at CaringBridge MNPHP Organizer Open Source Contributor (Zend Framework and various others) Where you can find me: • Twitter: mwillbanks G+: Mike Willbanks • IRC (freenode): mwillbanks Blog: http://blog.digitalstruct.com • GitHub: https://github.com/mwillbanks Housekeeping…
Push Notifications (C2DM) •Apple Push Notifications (APNS) •Microsoft Push Notifications •BlackBerry Push Notifications •Questions Although you can bring them up at anytime! Agenda
central location and delivered to you. Are (often) the same thing at a pub/sub model. In the Mobile Space… • These messages often contain other technologies such as alerts, tiles, or raw data. What Are They
runs in the device background and enables your application to receive the message. •The other part of this; if you implemented it otherwise you would be polling. This not only wastes precious battery but also wastes their bandwidth. NOTE: This is not always true; if you are sending data to the phone more often than a poll would do in 15 minutes; you are better off implementing polling. Battery Life
to save on battery. In a push notification these happen almost instantly. We’ve generally seen within 1-3s between sending a push notification to seeing it arrive on the device. •Additionally; push notifications can be sent to the device even if it is offline or turned off. •However, not all messages are guaranteed for delivery You may hit quotas Some notification servers only allow a single message to be in queue at 1 time (some group by collapse key), and others remove duplicates. Delivery
with the other libraries that currently existed. •More fluid way of sending push notifications. •Requires Zend Framework 1.x Committed in the ZF trunk; waiting for 1.12 release. •Handles sending push notifications to 3 systems APNS, C2DM and MPNS •Library is located in my GitHub account & ZF Trunk https://github.com/mwillbanks/Zend_Mobile http://framework.zend.com/svn/framework/standard/trunk/libra ry/Zend/Mobile/ Overview of Zend_Mobile_Push
include_path (likely set in index.php) •You’re ready to rock! •Once you upgrade to 1.12 after it is released you won’t have anything more to do. Setting up the Library
to their Android applications. •C2DM makes no guarantees about delivery or the order of messages. •An application on an Android device doesn’t need to be running to receive messages. •It does not provide any built-in user interface or other handling for message data. •It requires devices running Android 2.2 or higher that also have the Market application installed. •It uses an existing connection for Google services (Through the Google Market) Understanding C2DM
actually utilize C2DM http://code.google.com/android/c2dm/signup.html C2DM only works on Android w/ Google Market • Basically excludes: Amazon Kindle Fire. Registering for C2DM
is 256 bytes. •It allows third-party application servers to send lightweight messages to their iPhone/iPad applications. •Apple makes no guarantees about delivery or the order of messages. •An application on an iPhone/iPad device doesn’t need to be running to receive messages. •Message adheres to strict JSON but is abstracted away for us in how we will be using it today. •Messages should be sent in batches. •A feedback service must be listened to. Understanding APNS
the provisioning portal •After this is completed the provisioning profile will need to be utilized for the application. •Lastly, you will need to install the certificate and key on the server. In this case; you will be making a pem certificate. Preparing to Implement Apple Push Notifications
The delegate implements the application:didRegisterForRemoteNotificationsWithDeviceToken: method to receive the device token. It passes the device token to its provider as a non-object, binary value. •Notification By default this just works based on the payload; for syncing you would implement this on the launch. How the Application Works
to their Windows Mobile applications. •Microsoft makes no guarantees about delivery or the order of messages. (See a pattern yet?) •3 types of messages: Tile, Toast or Raw •Limitations: One push channel per app, 30 push channels per device, additional adherence in order to send messages 3K Payload, 1K Header •http://msdn.microsoft.com/en-us/library/ff402537.aspx Understanding MPNS
Key-Usage value of the TLS certificate must be set to include client authentication. The Root Certificate Authority (CA) of the certificate must be one of the CAs listed at: SSL Root Certificates for Windows Phone. Stays authenticated for 4 months. Set Service Name to the Common Name (CN) found in the certificate's Subject value. Install the TLS certificate on your web service and enable HTTP client authentication. Preparing to Implement MPNS
to their BlackBerry applications. •Allows a whopping 8K or the payload •Uses WAP PAP 2.2 as the protocol •Mileage may vary… Understanding BlackBerry Push
their Push SDK. Many of which are pre-compiled. Documentation is hard to follow and the sample isn’t exactly straight forward: • Install the SDK then go to BPSS/pushsdk-low-level/sample-push- enabled-app/ and unzip sample-push-enabled-app-1.1.0.16-sources.jar Completely uncertain on how to make it all work… Application Code
of the application details ready to go: https://www.blackberry.com/profile/?eventId=8121 •Download the PHP library: NOTE: I am not certain if any of these actually work… Updated to be OO; non-tested and a bit sloppy: https://github.com/mwillbanks/BlackBerryPush Original source: http://bit.ly/nfbHXp Preparing to Implement
works. •If you do use BlackBerry push messages; please connect with me I would like to allow us to get these into the component. Implementing BB Push w/ PHP
that is more inline with where Zend Framework 2 is going. However, there are bigger fish to fry at this point. •BlackBerry There is a need for a quality implementation in PHP but RIM’s documentation and how they work with developers makes this increasingly difficult. • Register, Forums and bad documentation… all for? Next steps
Google C2DM (Android): http://code.google.com/android/c2dm/ Microsoft Push Notifications: http://msdn.microsoft.com/en- us/library/ff402558(v=vs.92).aspx BlackBerry Push Notifications: http://us.blackberry.com/developers/platform/pushapi.jsp • Push Clients: Zend_Mobile: • https://github.com/mwillbanks/Zend_Mobile • http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Mobile/ BlackBerry: https://github.com/mwillbanks/BlackBerryPush • Might be broken but at least better than what I found anywhere else Resources