35
© 2009 Research In Motion Limited Advanced Java Application Development for the BlackBerry Smartphone Trainer name Date

© 2009 Research In Motion Limited Advanced Java Application Development for the BlackBerry Smartphone Trainer name Date

Embed Size (px)

Citation preview

© 2009 Research In Motion Limited

Advanced Java Application Development for the BlackBerry Smartphone

Trainer name

Date

© 2009 Research In Motion Limited

Agenda

In this course, you will cover the following topics:

– Introduction to advanced mobile application development for the BlackBerry® smartphone

– Application control for mobile devices

– Optimization for mobile application development

– Advanced BlackBerry user interface

– Introduction to multimedia application development for the BlackBerry smartphone

– Understanding push technology

© 2009 Research In Motion Limited

Agenda

In this course, you will cover the following topics:

– Understanding client/server push

– Introduction to developing Bluetooth® applications for mobile devices

– Developing secure applications

Advanced Java Application Development for the BlackBerry Smartphone

Objectives

– Explain client/server push and describe the benefits of push

– Explain how to write a basic client-side push application

– Explain how to write a basic server-side push application

– Describe and use the various features of push reliability

© 2009 Research In Motion Limited

© 2009 Research In Motion Limited

Explain client/server push

© 2009 Research In Motion Limited

Client/server push

– Client/server push applications send data from a server-side application to a custom client application on the BlackBerry smartphone.

– Requires a custom client application

– Provides more control than browser push applications

© 2009 Research In Motion Limited

Client/server push

– Two applications are involved in client/server push:

• A server-side push application

• A client-side listener

© 2009 Research In Motion Limited

Writing a basic client-side push application

– A client-side push application requires a listening thread

– Applications send and receive data on a separate thread

– Basic client-side push application:

• Verify that the client BlackBerry smartphone is in a wireless coverage area

• Open an input stream

• Close the stream connection notifier

Overview of the PAP push format

© 2009 Research In Motion Limited

© 2009 Research In Motion Limited

Overview of the PAP push format

– Server-side applications can use the PAP push format to send three types of requests:

• Push request

• Status-query request

• Cancellation request

– All three requests are sent as an HTTP POST to the BlackBerry MDS Connection Service

PAP Push Access Protocol

HTTP Hyper-text transfer protocol

MDS mobile data system

© 2009 Research In Motion Limited

Overview of the PAP push format

Constructing a PAP control entity

– A PAP control entity is an XML document which contains the control information that is required by the Push Access Protocol

– It must be the first entity in a push request

– All PAP control entities have three common document elements

XML Extensible markup language

Overview of the RIM push format

© 2009 Research In Motion Limited

© 2009 Research In Motion Limited

Overview of the RIM push format

– Server-side applications can use the RIM push format to send both the data and delivery parameters to the BlackBerry MDS Connection Service in a single byte stream

– The request is sent as an HTTP POST request using the following format:

POST http://<MDS_CS>:<MDS_CS_port>/push?DESTINATION=<destination>&PORT=<client_port>&REQUESTURI=<uri><headers><data> XML Extensible markup language

© 2009 Research In Motion Limited

Overview of the RIM push format

– HTTP headers for the RIM push format

– Receiving a RIM push format result notification

– Response codes for the RIM push format

XML Extensible markup language

Writing a basic server-side push application

– To write a basic server-side push application, complete the following steps:

1. For PAP push, specify the push parameters. (For RIM push, the parameters are specified as part of the Push web address.)

2. Connect to the BlackBerry MDS Connection Service

3. Define the properties for the HTTP POST request.

4. Write data to the server connection.

5. Read the server response.

6. Close the server connection.

© 2009 Research In Motion Limited

Creating a push request

© 2009 Research In Motion Limited

Creating a push request

– A push request is made up of the data to be pushed and a set of delivery parameters

– 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

Creating a push request

– In addition, the PAP push service implementation supports the following features:

• Push cancellation

• Push status query

© 2009 Research In Motion Limited

Creating a push request

Pushing data to multiple BlackBerry smartphone users

– Submit a single push request for multiple BlackBerry smartphone users

– Two methods to send to multiple email addresses are:

• By specifying multiple email addresses or BlackBerry smartphone PINs in the push request

• By specifying a BlackBerry user group (which specifies multiple recipients using a single address) in the push request

© 2009 Research In Motion Limited

Creating a push request

Pushing data to multiple recipient addresses

– Pushing data to multiple recipient addresses rather than a BlackBerry user group allows you to do the following for individual recipients:

• Cancel

• Query

• Receive result notifications

© 2009 Research In Motion Limited

Creating a push request

Pushing data to multiple recipient addresses

– Can result in large push requests which might cause issues, such as URL limitations

– To push data to multiple recipient addresses:

• For PAP push include an <address> element for each intended recipient

• For RIM push include a separate destination parameter for each intended recipient

© 2009 Research In Motion Limited

Creating a push request

Pushing data to a BlackBerry user group

– BlackBerry user groups are administered on the server and represent multiple recipients using a single address

– The group is seen as a single entity which limits flexibility of a push application

© 2009 Research In Motion Limited

Creating a push request

Pushing data to a BlackBerry user group

– To push data to a group:

• PAP push include a single <address> element

• RIM push include a single DESTINATION parameter

© 2009 Research In Motion Limited

Creating a push request

Using push request reliability

– To receive notifications on a push request, specify the reliability level and a notification URL

– If a custom client is receiving the pushed data the port must be registered on the BlackBerry MDS Connection Service

– If the pushed data is sent to the BlackBerry Browser the port is already registered

© 2009 Research In Motion Limited

Creating a push request

Using push request reliability

– Only BlackBerry Device Software versions 3.8 or later support application reliable push requests

– Application-reliable push requests that do not require registration, develop your application so it sends an HTTP request

– To specify a reliable push request:

• PAP push include the <quality-of-service> element

• RIM push include the x-Rim-Push-Reliability header

© 2009 Research In Motion Limited

Creating a push request

Using push request reliability

– Levels of reliability

• Transport

• Application

• Application - preferred

© 2009 Research In Motion Limited

Creating a push request

Receiving push result notifications

– application-level or transport-level reliability push requests require a valid notification URL

– The BlackBerry MDS Connection Service sends all result notifications to the notification URL as an HTTP POST

© 2009 Research In Motion Limited

Creating a push request

Specifying time restrictions for push delivery

– Define a delivery period for delivering the pushed data

• Deliver-after date and time

• Deliver-by date and time

© 2009 Research In Motion Limited

Creating a push request

Querying the status of push requests

– Query the status of the push request for one or more recipients

– Zero recipients returns a status for all the recipients, specify one or more to return limited results

– Groups only return a status for the entire group

– Can result in unnecessary network traffic

© 2009 Research In Motion Limited

Creating a push request

Cancelling a pending push request

– Cancelation requests are possible using PAP push format

– Zero recipients returns a status for all the recipients, specify one or more to return limited results

– Groups only return a status for the entire group

– If the request is still pending cancelation is possible, recall of sent data is not possible

© 2009 Research In Motion Limited

Summary

© 2009 Research In Motion Limited

Summary

– Client/server push applications send data from a server-side application to a custom client application.

– A client-side push application requires a listening thread and sends and receives data on a separate thread.

– You can use any programming language that can establish an HTTP connection to create a server-side push application.

© 2009 Research In Motion Limited

Summary

– A push request can require a server-side application to be notified when pushed data arrives

© 2009 Research In Motion Limited

© 2009 Research In Motion Limited

© 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.