Push technology for Java applications Trainer name Date © 2009 Research In Motion Limited v0.01 Revision history Document version 0.1 736-01827-123 Date Updated by Angela-Jo Griffin © 2009 Research In Motion Limited Description of revision Initial content creation Agenda In this course, you will cover the following topics: – Introduction to Java® application development for mobile devices – Understanding Java APIs for mobile devices – Developing a user interface for mobile devices – Push technology for Java applications – Introduction to threading and background processing – Network communication for mobile devices – Testing and debugging an application API © 2009 Research In Motion Limited application programming interface Push technology for Java applications Introduction to push technology for Java applications Objectives: – Describe push technology – Describe client/server push Java applications for a mobile device such as a BlackBerry smartphone – List and explain the advantages and disadvantages of push technology for mobile devices – Write a basic client/server push Java application for a mobile device such as a BlackBerry smartphone © 2009 Research In Motion Limited Introducing push technology Introducing push technology Push technology: – The ability to proactively deliver, or push, data to BlackBerry smartphones © 2009 Research In Motion Limited Introducing push technology Push applications for the BlackBerry® Enterprise Server: – Use the BlackBerry MDS Connection Service component of the BlackBerry Enterprise Server to deliver data or web content directly to any BlackBerry smartphone – Users do not need to request or download data – The push application, in conjunction with the BlackBerry MDS Connection Service, delivers the data as soon as it is available © 2009 Research In Motion Limited Introducing push technology Two applications are required to push data to a BlackBerry smartphone: – Server-side push application that submits the push request – Client-side listener application that listens for incoming push messages Introducing push technology Server-side push application: – Designed to send HTTP POST requests to the BlackBerry MDS Connection Service on the web server listen port – The HTTP POST requests contain delivery parameters and the data to be pushed – The BlackBerry MDS Connection Service then delivers the data to a specified port number on the BlackBerry smartphones within a specified time frame HTTP MDS Hypertext Transfer Protocol Mobile Data System Introducing push technology Client-side listener application: – Listens for data to be delivered to its specific port number – You can create a custom BlackBerry MDS Java Application designed to listen for and handle pushed data – You can push web content to the BlackBerry® Browser – The BlackBerry Browser has an integrated listener thread Introducing push technology The BlackBerry MDS Connection Service: – Manages the flow of pushed data from various push applications – Sends the data to the BlackBerry smartphone using the same encrypted channel that is used for data communication between the BlackBerry smartphone and the BlackBerry Enterprise Server – Pushes data to individual users or to user groups © 2009 Research In Motion Limited Client/server push application Client/server push application Client/server push applications: – Consist of a custom client BlackBerry smartphone application and a server-side application – Push content to the client BlackBerry smartphone – Provide more control than browser push applications – Provide more flexibility regarding the type of data sent and how the BlackBerry smartphone processes and displays the data © 2009 Research In Motion Limited Client/server push application Advantages: – Store data on the BlackBerry smartphone – Make network connections based on the information that comes in – Integrate the data with BlackBerry applications © 2009 Research In Motion Limited Client/server push application Server-side push applications: – Make requests to the BlackBerry MDS Connection Service to push data to specified BlackBerry smartphone users Requests include push delivery parameters that: – Uniquely identify the push request – Inform the BlackBerry MDS Connection Service which BlackBerry smartphones to send the data to – Provide additional delivery information, such as the priority and the reliability level of the push request © 2009 Research In Motion Limited Client/server push application Supported push formats: – PAP push format – RIM® push formats PAP RIM © 2009 Research In Motion Limited Push Access Protocol Research In Motion Client/server push application PAP push format: – Sends an HTTP POST request to the BlackBerry MDS Connection Service. – The request contains a MIME multipart message that includes two components • An XML-based PAP control entity that defines the delivery parameters • The data to be pushed – The PAP push format is an open standard developed by the MIME Multipurpose Internet Mail Open Mobile Alliance. XML © 2009 Research In Motion Limited Extensions Extensible Markup Language Client/server push application RIM push format: – Sends an HTTP POST request to the BlackBerry MDS Connection Service – Pushes content as a byte stream – The destination port is specified within the URL of the pushed content, and the destination users and other delivery parameters are specified in HTTP headers included with the request – Is a proprietary push format supported exclusively by the BlackBerry MDS Connection Service and BlackBerry smartphone URL © 2009 Research In Motion Limited Uniform Resource Locator Client/server push application A push request consists of: – The data to be pushed – A set of delivery parameters © 2009 Research In Motion Limited Client/server push application Both the PAP push and RIM push formats support the following features: – Reliable push requests – Deliver-Before time stamp – Deliver-After time stamp © 2009 Research In Motion Limited Client/server push application PAP push service also supports the following features: – Push cancellation – Push status query © 2009 Research In Motion Limited Client/server push application Client-side listener applications – Client-side listener applications listen for incoming data – You can create a custom BlackBerry MDS Java Application that contains a listening thread that listens for incoming data on a specified port – To create a Java-based push application architecture, you must create both the custom client-side application that receives the pushed data and the server-side application that makes the push request © 2009 Research In Motion Limited Client/server push application Push applications provide a wider range of applications that enhance the BlackBerry experience for BlackBerry smartphone users. You can use push applications for time- and location-sensitive alerts, such as: – News and weather – Banking and stocks – Medical services – Sports scores – Backup notifications © 2009 Research In Motion Limited Advantages and disadvantages of push technology for mobile devices Advantages and disadvantages of push technology for mobile devices Advantages: – Immediacy – Efficiency – Reduced latency – Longer battery life – Shorter learning curve © 2009 Research In Motion Limited Advantages and disadvantages of push technology for mobile devices Disadvantages: – Limited format – No delivery status for individuals within a group address © 2009 Research In Motion Limited Client/server push Java applications Client/server push Java applications Your server-side application can use the PAP push format to send the following three types of requests to the BlackBerry MDS Connection Service: – Push request • Permits you to push data to the specified recipients – Status-query request • Permits you to query the status of a push request for one or more specified recipients – Cancellation request • Permits you to cancel a push request for one or more specified recipients © 2009 Research In Motion Limited Client/server push Java applications Send the request as an HTTP POST request to the BlackBerry MDS Connection Service. If the BlackBerry MDS Connection Service is configured to support secure connections, you can use the HTTPS protocol. The HTTP POST request must use the following format: POST http://<MDS_CS>:<MDS_CS_port>/pap <message> © 2009 Research In Motion Limited Client/server push Java applications To create a PAP push request: 1. Send an HTTP POST request. 2. To push content to multiple recipients using PAP, add multiple address tags to the post request. 3. To push content to a group using PAP, in the recipient addresses part of the push submission, prefix the group name with the $ character. © 2009 Research In Motion Limited Client/server push Java applications RIM push format: – Your server-side application can use the RIM push format to send both the data and the delivery parameters to the BlackBerry MDS Connection Service in a single byte stream. – Send the request as an HTTP POST request to the BlackBerry MDS Connection Service. – If the BlackBerry MDS Connection Service is configured to support secure connections, you can use the HTTPS protocol. © 2009 Research In Motion Limited Client/server push Java applications RIM push format: – The HTTP POST request must use the following format: POST http://<MDS_CS>:<MDS_CS_port>/push? DESTINATION=<destination>&PORT=<client_port >&REQUESTURI=<uri> <headers> <data> © 2009 Research In Motion Limited Client/server push Java applications You can create a RIM push request three different ways: 1. To push content to one or multiple BlackBerry smartphone users using a RIM push request, send an HTTP POST request using the following URL format. http://mdsServer:web server listen port/push?DESTINATION=destination& PORT=port&REQUESTURI=uri headers content © 2009 Research In Motion Limited Client/server push Java applications 2. To push content to multiple recipients using a RIM push, include multiple DESTINATION parameters in the query string. http://mds_server:8080/push?DESTINATION= user1@rim.com&DESTINATION=user2@rim.com&POR T=7874&REQUESTURI=/ 3. To push content to a group using RIM push, in the recipient addresses portion of the push submission, prefix the group name with the $ character. © 2009 Research In Motion Limited © 2009 Research In Motion Limited Legal Disclaimer The following trademarks and/or registered trademarks of Research In Motion are referred to in this presentation: – BlackBerry® – Research In Motion® (only include if it appears in the webinar/presentation) – RIM® (only include if it appears in the webinar/presentation) The following BlackBerry products are referred to in this presentation: (include all items from the official BlackBerry products list that appear in the webinar/presentation) – BlackBerry® Internet Service – BlackBerry® Enterprise Solution – BlackBerry® Enterprise Server – BlackBerry® Pearl™ 8100 smartphone – BlackBerry® Curve™ 8300 smartphone The following third-party trademarks are referred to in this presentation: (include all third-party products that appear in the webinar/presentation) – Microsoft® Excel® – Microsoft® SQL Server® Please remove any products not mentioned in this presentation and add all mentioned products before completing this presentation. Also, remove any remaining red text. © 2009 Research In Motion Limited Legal Disclaimer © 2009 Research In Motion Limited. All rights reserved. BlackBerry®, RIM®, Research In Motion®, SurePress™ SureType® and related trademarks, names and logos are the property of Research In Motion Limited and are registered and/or used in the U.S. and countries around the world. All other trademarks are the property of their respective owners. This documentation is provided "AS IS" and without condition, endorsement, guarantee, representation or warranty, or liability of any kind by Research In Motion Limited and its affiliated companies, all of which are expressly disclaimed to the maximum extent permitted by applicable law in your jurisdiction. © 2009 Research In Motion Limited