• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Bb push sapra
 

Bb push sapra

on

  • 608 views

Published by Althea Elfleda Tolentino McGregor, BlackBerry Dev Alpha, January 2012, Licensed Vendor for BlackBerry World App and Development, Social Media, Digital Content by BlackBerry Laws, ...

Published by Althea Elfleda Tolentino McGregor, BlackBerry Dev Alpha, January 2012, Licensed Vendor for BlackBerry World App and Development, Social Media, Digital Content by BlackBerry Laws, Copyrights, Authorship, Commercial Rights and Compliance , Health & Safety Compliance, IP Laws Pioneer for Data Encryption, Global Entrepreneur, Global Sales and Social Media Networking, Global Vending, Attributed Use for all Global Resellers of BlackBerry Products and Services, Digital Content, Patent, Global Promotion for BlackBerry Apps Development and the Foundation for a Raving Tigers BlackBerry Business Solutions as per stipulations and agreements on policies and rights over use , print and distribution to re-distribution over corporations of Global Merchandising of Communication Devices that pioneers data encryption and Social Hubs as attributions to the hallmarks of BlackBerry Dev Alpha C into the market release version of the BlackBerry Z10 and BlackBerry Q10 as separate and treated as one unit of manufactured programming,from its concept to approval which must meet Blackberry standard for its release and hacked for its vulnerability on CrackBerry exclusive to both "Gods" and Demons" of this world of the Fruit-wares, called BlackBerry and these could be coded as well. Z10 and Q10. Written by: Althea Elfleda Tolentino McGregor, Blackberry Dev Alpha A to C, 2012 to present and 10% only addicted, for the love of GOD! No mercy until I get my millions and a private jet, a school or an intellectual law institution or many. I am the Pioneer of WORK IN MOTION FOR my Raving Tigers Business Solutions which is for micro/macro economic developments and dependent on consumerism as well as the provision of scholarships to increase revenues for BlackBerry in the deliverance of its goal for mobilisation of these technologies, as an integral part of the backbone of every struggling small business owners who only needs one device, a BlackBerry. © 2013 Research In Motion Limited, 295 Phillip St., Waterloo, Ontario, Canada, N2L 3W8. All rights reserved. BlackBerry®, RIM®, Research In Motion® and related trademarks, names and logos are the property of RIM and are registered and/or used in the U.S. and countries around the world.

Statistics

Views

Total Views
608
Views on SlideShare
608
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Bb push sapra Bb push sapra Presentation Transcript

    • BlackBerry Push Infrastructure at Work: Introduction to the BlackBerry Push API Pratik Sapra Application Development Specialist
    • BlackBerry Push Infrastructure at Work: Introduction to the BlackBerry Push API • Overview • Architecture • Implementation • Security & Reliability • Requesting Access
    • Why use Push? • The data is on the device when the user needs it • Data is delivered as soon as it is available • Application is always actively listening for data arrival • User can be immediately notified of new data • Audio alert, vibration, blinking LED, pop-up dialog, icon change, banner notification • The user experience is that it just happened • appearance of zero latency
    • Push Vs Poke-Pull • Push • Allows the delivery of content to a device without the device having to request it • The data is sent to a port on the device where an application is listening for it • Push is generally server based/mediated • Push Initiator • The Push Initiator submits a request to the Hosted Data Push Service • Contains delivery instructions and the payload – Delivery instructions describe where and how the data is to be sent – The payload may be any type of data • Poke-and-Pull • Poke: a notification and URL are pushed to a device • Pull: the device fetches the content at the URL • Less efficient than true push
    • BlackBerry Push API • Compare to Polling • Client periodically asks a server if an event of interest has occurred • Inefficient – increases OTA costs and traffic • there may be many polling attempts to fetch a single event • Delays in getting data due to polling latency (interval) • Depending on polling interval, received data may be outdated • Wastes battery life checking whether an event of interest has occurred • Generates extra server traffic and load for your application • 1,000,000 devices x 12 polls/hr x 24 hours = 288,000,000 requests per day • Doesn’t scale
    • BlackBerry Push API • Provides a transport infrastructure for Server to Device pushed data • Primary focus on consumer applications • Alerts • Replace polling to improve performance & reduce costs • Poke-Pull model • Event driven systems • Near real-time notifications • Can be used for enterprise deployments • Cross company applications • Enterprises without a BlackBerry Enterprise Server
    • Benefits • Provides information immediately • Optimizes network efficiency • Preserves the battery life • Reduces complexity for developers • Improves developer margins
    • Architecture • Pushes are initiated on the Server • Server side application is required • Server to Server interface for the Push Initiator • BlackBerry Infrastructure is the middleware • Sends data to a specified port on the Device • Client side Java application required to receive the push • Uses PAP 2.2 Standard push protocols • OMA-WAP-TS-PAP-V2_2-20071002-C • Requests are HTTP XML requests • Supported requests: • Submit Push • Cancel Push • Query for Status • Response: • Result notification
    • Components Three major components: • The server-side push service • A client-side application • BlackBerry Infrastructure
    • Push Workflow Mobile Client Push Request Response BlackBerry Infrastructure 1 2 3 4 5 6 Push Push Initiator 1. Server sends PAP Push which contains a list of specified devices 2. BlackBerry Infrastructure sends response to Server and queues request 3. BlackBerry Infrastructure pushes data to specified devices 4. Each device sends ACK to BlackBerry Infrastructure 5. BlackBerry Infrastructure sends notification to Server 6. Server sends Read notification to BlackBerry Infrastructure
    • About the Push • Push sent to user’s PIN • Maximum payload is 8 KB • Types of Push: • Point to Point (Single PIN) • Multicast (List of PINs) • Broadcast (All PINs by application) • BlackBerry Infrastructure will attempt to deliver the message until expiry time • Automatic retries if device is out of coverage • Expiry time can be configured to a maximum of 8 hours
    • Sample Push Request --PMasdfglkjhqwert Content-Type: application/xml <?xml version="1.0"?> <!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd"> <pap> <push-message push-id="999999999" source-reference="AAAAAAAAAAAA" deliver-before-timestamp="2008-09-31T13:30:00Z" ppg-notify-requested-to="notify_url_path"> <address address-value="PIN00001"/> <address address-value="PIN00002"/> <address address-value="PIN00003"/> <quality-of-service delivery-method="confirmed"/> </push-message> </pap> --PMasdfglkjhqwert Content-Encoding: binary Content-Type: text/html Text or binary content to be delivered to BlackBerry device goes here. --PMasdfglkjhqwert--
    • Sample Code: Push Request (1 of 2) HttpURLConnection mdsConn = null; InputStream ins = null; OutputStream outs = null; String errorCode = null; try { URL mdsUrl = new URL(BLACKBERRY_INFRASTRUCTURE_URL); mdsConn = (HttpURLConnection) mdsUrl.openConnection(); String boundary = ""; boundary = "asdlfkjiurwghasf"; mdsConn.setRequestProperty("Content-Type", "multipart/related; type="application/xml";boundary=" + boundary); String auth = "Basic " + new BASE64Encoder().encode((_psid + ":" + _password).getBytes()); mdsConn.setRequestProperty("Authorization", auth); mdsConn.setRequestMethod("POST"); mdsConn.setAllowUserInteraction(false); mdsConn.setDoInput(true); mdsConn.setDoOutput(true); /* … Continued on next slide … */
    • Sample Code: Push Request (2 of 2) String papPush = “…”; //push message outs = mdsConn.getOutputStream(); copyStreams(new ByteArrayInputStream(output.getBytes()), outs); mdsConn.connect(); ins = mdsConn.getInputStream(); ByteArrayOutputStream response = new ByteArrayOutputStream(); copyStreams(ins, response); int httpCode = mdsConn.getResponseCode(); if( httpCode != HttpURLConnection.HTTP_ACCEPTED && httpCode != HttpURLConnection.HTTP_OK ) { //Push failed } else { //HTTP Connection successful //Parse the response notification message to confirm successful push (not shown here) } } catch(Exception ex) { errorCode = ex.getClass().getName(); } finally { /* close input and output streams and close the connection */ }
    • Sample Cancel Request • Any queued pushes can be cancelled • Previously pushed content cannot be recalled • Result notification sent from BlackBerry Infrastructure – Confirms for which devices the pushes were and were not cancelled • Uses WAP PAP <cancel-message> element
    • Sample Cancel Request Content-Type: application/xml <?xml version="1.0"?> <!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd"> <pap> <cancel-message push-id="999999999"> <address address-value="PIN00001"/> <address address-value="PIN00002"/> <address address-value="PIN00003"/> </cancel-message> </pap>
    • Status Request • Query for the status of a submitted request • Status is maintained for 24 hours • If multiple recipients • response will contain a status for all of them • Status is a snapshot • i.e. reflective only of the current moment in time • Uses WAP PAP <statusquery-message> element
    • Sample Status Request Content-Type: application/xml <?xml version="1.0"?> <!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd"> <pap> <statusquery-message push-id="999999999"> </statusquery-message> </pap>
    • Response Notifications • Sent to the Server URL if specified, none otherwise • Be prepared to handle these – there will be many of them – Quality of Service Levels • Application – Message reached the application • Transport – Message reached the device • None – Fire and forget
    • Listening for Push • User installs mobile application • On first run, mobile application registers with BlackBerry Infrastructure – Creates HTTPS connection to Infrastructure URL • Headers identify PIN and PSID • BlackBerry Infrastructure validates the mobile application • BlackBerry Infrastructure returns pass/fail to mobile application
    • Sample Code: Listening for Push StreamConnection stream; InputStream ins; MDSPushInputStream pushInputStream; //use the port assigned to your application StreamConnectionNotifier notifier = (StreamConnectionNotifier) Connector.open("http://:110"); while( !_stop ) { stream = _notifier.acceptAndOpen(); //blocking operation input = stream.openInputStream(); pushInputStream = new MDSPushInputStream((HttpServerConnection) stream, input); DataBuffer buffer = new DataBuffer(); byte[] data = new byte[ 256 ]; int chunk = 0; while( -1 != (chunk = input.read(data)) ) { buffer.write(data, 0, chunk); } /* … process the data on the DataBuffer ... */ // Signal that we have finished reading. pushInputStream.accept(); }
    • Security • BlackBerry Infrastructure Authentication • Push Initiator is authenticated to the BlackBerry Infrastructure • Push Initiator can only push to its mobile application • 1:1 relationship between Push Initiator and mobile application • Push Initiator can only push to devices registered for their application • Each push request is authenticated to BlackBerry Infrastructure • Unique listening port for each application • BlackBerry Infrastructure does not encrypt data • Expects that payload data will already be encrypted by Push Initiator • Content Provider Authentication • Mobile application should be authenticated to the Push Initiator
    • Reliability • Choose the appropriate QoS for your application • There are tradeoffs for performance and battery life • Be sure to handle all request failures in your application • Result notifications • Your server app must be prepared to handle these, if you request them • Server outages - RIM infrastructure will retry deliveries … for a while • Always provide an unsubscribe option in your device application • Highest reliability can be achieved by application acknowledgement direct to your server
    • Requesting Access • Register at www.blackberry.com/pushapi • Sample code provided on registration approval • Content Provider tests the push service • Given access to the evaluation infrastructure • Research In Motion validates the Content Provider’s client and server-side applications • Ensuring development guidelines are met • Service is moved into production • Once all requirements are met • Only available to ISV Alliance Partners • To become an ISV Alliance partner visit www.blackberry.com/allianceapplication • Contact for service costs
    • Thank You Pratik Sapra – Application Development Specialist