SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Building HTML5 apps with native
capabilities
Jorge del Casar – @jorgecasar
February 29, 2013
HTML5 is good for developers
Community momentum
What can you do with HTML5?

  Geolocation
  Web Sockets
  Offline storage
  Audio / Video               ScoreMobile Tablet


  Notifications
  WebGL
  … and more
                                  Slacker
HTML5Test.com




http://html5test.com/compare/browser/bb07/rimtabletos20/bb10.html
                                                                    5
BlackBerry WebWorks


               “A cross-platform HTML5 application framework for
                creating standalone BlackBerry applications “
Real Examples in App World




    The Economist     News360       HockeyCentral




    Huffington Post   Pesktop   Canada’s Got Talent
HTML5 powered by WebWorks

HTML5, CSS3, JavaScript

  WebKit engine

     WebWorks platform

        BlackBerry Developer APIs

               https://developer.blackberry.com/html5/api
How to get there?




    Web Assets      WebWorks Tools   BlackBerry Applications
Connect HTML5 with native device
capabilities
Software & hardware & data … oh my!




                                      10
Storage

  HTML5 localStorage
     Name-value pairs
       localStorage.clear();
       localStorage.setItem("Greeting", "Hello World");

       key = localStorage.key(0);               // "Greeting"
       item = localStorage.getItem(key);        // "Hello World"

  HTML5 Web DB
     Structured relational database


      var size = 2 * 1024 * 1024;
      db = window.openDatabase("WebDB", "1.0", "Example", size, onInit);
HTML5 File System

 Read/Write native file-system
 Able to un-sandbox when wrapped in WebWorks
  function gotFile(fileEntry) {
     fileEntry.createWriter(gotWriter, errorHandler);
  }
  function gotFs(fs) {
      fs.root.getFile(blackberry.io.sharedFolder +
          "/downloads/blackberry.jpg",
      {create: true}, gotFile, errorHandler);
  }
  ...

  blackberry.io.sandbox = false;
  window.webkitRequestFileSystem(PERSISTENT, 10 * 1024, gotFs,
      errorHandler);
  }
Touch

    Define custom touch event handlers
       Up to 4-finger touch events supported
       See “Sample Code – SketchPad Application” http://bit.ly/hz67JX

document.ontouchstart = function(event) {

    //Tell browser engine not to scroll/span/zoom
    // when user touches screen:
    event.preventDefault();

    var touch = event.changedTouches[0];
    alert(touch.pageX + "," + touch.pageY);
                                                          Pong-port sample
}
                                                          http://spaceport.io
Accelerometer, Magnetometer

  HTML5 Device motion, Orientation
     Respond to physical user input
window.addEventListener("devicemotion",
   function(event) {

       var x = event.accelerationIncludingGravity.x;
       var y = event.accelerationIncludingGravity.y;
       var z = event.accelerationIncludingGravity.z;

       // Facing up from the Earth’s surface is:
      // { x : 0, y : 0, z : 9.81 }

}, true);

                                                       Aura sample app
GPS

     HTML5 Geolocation
        Retrieve users’ GPS coordinates
        Provide location-aware content
function onSuccess(position) {

    console.log("lat = " + pos.coords.latitude);
    console.log("lon = " + pos.coords.longitude);

}

var ops = { enableHighAccuracy : true };

navigator.geolocation.getCurrentPosition(
                      onSuccess, onError, ops);
Web Notification

  HTML5 API for generating system messages
     Proactively notify users about application events
       var icon = "http://testuri.com/icon.png";
       var title = "Web Notification";
       var msg   = "Sent from the Kitchen Sink app.";

       var notification =
          webkitNotifications.createNotification(icon, title, msg);

       notification.show();

     Separate Notification() with app-like
      experience, BlackBerry Hub
HTML5: Media Capture

 Capture Picture/Video
 Leverages System Camera app
 <input type="file" accept="image/*" capture="camera">
HTML5 API: Sockets

    Real-time communication using persistent connections
       Frameworks: Socket.io, Pusher.js
       E.g. Twitter
       Requires server component

var url = "ws://my.url.com:8001";
var socket = new WebSocket(url);

socket.onmessage = function(e) {
   displayMessage(e.data);
}


                                           wordsquared.com
HTML5 API: WebGL

 3D graphics powered by OpenGL ES
    Frameworks: three.js, CopperLicht, SceneJS, GLGE
    GPU provides hardware acceleration




 Tunnel Tilt game
    Free download in App World
    Source code in Github
       https://github.com/blackberry/WebGL-Samples
BlackBerry 10
WebWorks reborn




                  20
WebWorks APIs

 JavaScript wrappers for OS developer APIs
    http://developer.blackberry.com/html5/api
    Identity, Invoke, System…




 Learning resources
    http://github.com/blackberry/WebWorks-Samples
    See “kitchen sink” sample application for demos
BlackBerry 10 WebWorks SDK

 JavaScript framework, backed by Native C/C++
    No longer Java J2ME or Adobe AIR

 JavaScript packager
    Running in Node.js

 API evolution
    W3C/Cordova alignment
    Build plan for future move
BlackBerry 10 and Ripple

                           Chrome extension
                           Multi-platform support
                              BlackBerry 10, Tablet
                               OS and BlackBerry OS
                           Build and sign
                           BlackBerry apps
Ripple mobile emulator

   Development tool for web developers
       Preview, test and build BlackBerry web applications
       Emulate device-specific APIs and capabilities
Remote Web Inspector

  What is it?
     Debug web content running on a remote device.
     Profile to optimize web page performance.
     Works with simulators or live devices
BlackBerry 10 WebWorks APIs


           blackberry.app

          blackberry.event

          blackberry.system

          blackberry.identity

              JavaScript        C/C++
BlackBerry 10 WebWorks

<script type="text/javascript" src="webworks.js"></script>




function onLoad() {
    document.addEventListener("webworksready", start);
}
Config.xml

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.100"
        id="webworkspim"
        xml:lang="en">

   <name>PIM Contacts</name>
   <author>Research In Motion</author>
   <content src="index.html"/>
   <icon src="appicon.png" />

   <feature id="blackberry.pim.contacts" />
Some recent API additions

  Invoke
     Invoke other apps, card
     Be invoked
  PIM
     Contacts
     Calendar, Messages on their way
  BBM
     Update profile, invite to download
Custom Extensions
Building your own WebWorks APIs




                                  30
Custom WebWorks APIs

 Build your own APIs
    Access native layer functionality
    Go beyond HTML5 and core WebWorks


 JavaScript interface for platform code
    BlackBerry OS = Java
                                          Lensboost
    Tablet OS = AIR                      Mblware Ltd


    BlackBerry 10 = C/C++
Custom WebWorks APIs

 WebWorks SDK for BlackBerry 10
    Platforms = BlackBerry 10
    Native language = C/C++



  javascript                                 native
      client.js   index.js   manifest.json   jnext.cpp jnext.hpp
Custom WebWorks APIs

 Open Source
    http://github.com/blackberry/WebWorks-Community-APIs
    Get started using TEMPLATE sample in Github
Resources
Places to go, people to see, what’s coming
next




                                             34
WebWorks Roadmap

 Frequent releases
 Incremental APIs, emulation




            http://developer.blackberry.com/downloads/roadmap
For more information




         http://developer.blackberry.com/html5
THANK YOU
Jorge del Casar - @jorgecasar
February 29, 2013

Weitere ähnliche Inhalte

Was ist angesagt?

Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
Chris Mills
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
Simon Willison
 
Firefox OS workshop, Colombia
Firefox OS workshop, ColombiaFirefox OS workshop, Colombia
Firefox OS workshop, Colombia
Robert Nyman
 
Building Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOSBuilding Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOS
FITC
 

Was ist angesagt? (20)

WebAPIs + Brick - WebBR2013
WebAPIs + Brick - WebBR2013WebAPIs + Brick - WebBR2013
WebAPIs + Brick - WebBR2013
 
Empowering the "mobile web"
Empowering the "mobile web"Empowering the "mobile web"
Empowering the "mobile web"
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
 
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
Firefox OS workshop, Colombia
Firefox OS workshop, ColombiaFirefox OS workshop, Colombia
Firefox OS workshop, Colombia
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web apps
 
Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...
Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...
Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...
 
Always on! ... or not?
Always on! ... or not?Always on! ... or not?
Always on! ... or not?
 
Building Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOSBuilding Progressive Web Apps for Android and iOS
Building Progressive Web Apps for Android and iOS
 
Microservices Architecture: Labs
Microservices Architecture: LabsMicroservices Architecture: Labs
Microservices Architecture: Labs
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 
Using Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web ApplicationsUsing Modern Browser APIs to Improve the Performance of Your Web Applications
Using Modern Browser APIs to Improve the Performance of Your Web Applications
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
 
Instant and offline apps with Service Worker
Instant and offline apps with Service WorkerInstant and offline apps with Service Worker
Instant and offline apps with Service Worker
 
Monitoring web application response times, a new approach
Monitoring web application response times, a new approachMonitoring web application response times, a new approach
Monitoring web application response times, a new approach
 
High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010
 

Ähnlich wie HTML5 WebWorks

WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert Nyman
 
Firefox os-introduction
Firefox os-introductionFirefox os-introduction
Firefox os-introduction
zsoltlengyelit
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
Christian Heilmann
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
Mozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open WebMozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open Web
Robert Nyman
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D2
 
WebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at GoogleWebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at Google
Robert Nyman
 
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San FranciscoFirefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Robert Nyman
 

Ähnlich wie HTML5 WebWorks (20)

WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
 
Firefox os-introduction
Firefox os-introductionFirefox os-introduction
Firefox os-introduction
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
 
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
"BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet""BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet"
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Html5
Html5Html5
Html5
 
Mozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open WebMozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open Web
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In Action
 
Firefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-webFirefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-web
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010
 
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
 
WebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at GoogleWebRTC & Firefox OS - presentation at Google
WebRTC & Firefox OS - presentation at Google
 
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
 
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
 
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San FranciscoFirefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
 

Mehr von Raul Jimenez (7)

HTML5 y WebGL
HTML5 y WebGLHTML5 y WebGL
HTML5 y WebGL
 
Realidad Aumentada
Realidad AumentadaRealidad Aumentada
Realidad Aumentada
 
Diseño inclusivo
Diseño inclusivoDiseño inclusivo
Diseño inclusivo
 
Mejorandola
MejorandolaMejorandola
Mejorandola
 
Taller subflash 2012
Taller subflash 2012Taller subflash 2012
Taller subflash 2012
 
DPS + HTML5
DPS + HTML5DPS + HTML5
DPS + HTML5
 
Adobe AIR Native Extensions
Adobe AIR Native ExtensionsAdobe AIR Native Extensions
Adobe AIR Native Extensions
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

HTML5 WebWorks

  • 1. Building HTML5 apps with native capabilities Jorge del Casar – @jorgecasar February 29, 2013
  • 2. HTML5 is good for developers
  • 4. What can you do with HTML5? Geolocation Web Sockets Offline storage Audio / Video ScoreMobile Tablet Notifications WebGL … and more Slacker
  • 6. BlackBerry WebWorks “A cross-platform HTML5 application framework for creating standalone BlackBerry applications “
  • 7. Real Examples in App World The Economist News360 HockeyCentral Huffington Post Pesktop Canada’s Got Talent
  • 8. HTML5 powered by WebWorks HTML5, CSS3, JavaScript WebKit engine WebWorks platform BlackBerry Developer APIs https://developer.blackberry.com/html5/api
  • 9. How to get there? Web Assets WebWorks Tools BlackBerry Applications
  • 10. Connect HTML5 with native device capabilities Software & hardware & data … oh my! 10
  • 11. Storage HTML5 localStorage  Name-value pairs localStorage.clear(); localStorage.setItem("Greeting", "Hello World"); key = localStorage.key(0); // "Greeting" item = localStorage.getItem(key); // "Hello World" HTML5 Web DB  Structured relational database var size = 2 * 1024 * 1024; db = window.openDatabase("WebDB", "1.0", "Example", size, onInit);
  • 12. HTML5 File System Read/Write native file-system Able to un-sandbox when wrapped in WebWorks function gotFile(fileEntry) { fileEntry.createWriter(gotWriter, errorHandler); } function gotFs(fs) { fs.root.getFile(blackberry.io.sharedFolder + "/downloads/blackberry.jpg", {create: true}, gotFile, errorHandler); } ... blackberry.io.sandbox = false; window.webkitRequestFileSystem(PERSISTENT, 10 * 1024, gotFs, errorHandler); }
  • 13. Touch Define custom touch event handlers  Up to 4-finger touch events supported  See “Sample Code – SketchPad Application” http://bit.ly/hz67JX document.ontouchstart = function(event) { //Tell browser engine not to scroll/span/zoom // when user touches screen: event.preventDefault(); var touch = event.changedTouches[0]; alert(touch.pageX + "," + touch.pageY); Pong-port sample } http://spaceport.io
  • 14. Accelerometer, Magnetometer HTML5 Device motion, Orientation  Respond to physical user input window.addEventListener("devicemotion", function(event) { var x = event.accelerationIncludingGravity.x; var y = event.accelerationIncludingGravity.y; var z = event.accelerationIncludingGravity.z; // Facing up from the Earth’s surface is: // { x : 0, y : 0, z : 9.81 } }, true); Aura sample app
  • 15. GPS HTML5 Geolocation  Retrieve users’ GPS coordinates  Provide location-aware content function onSuccess(position) { console.log("lat = " + pos.coords.latitude); console.log("lon = " + pos.coords.longitude); } var ops = { enableHighAccuracy : true }; navigator.geolocation.getCurrentPosition( onSuccess, onError, ops);
  • 16. Web Notification HTML5 API for generating system messages  Proactively notify users about application events var icon = "http://testuri.com/icon.png"; var title = "Web Notification"; var msg = "Sent from the Kitchen Sink app."; var notification = webkitNotifications.createNotification(icon, title, msg); notification.show();  Separate Notification() with app-like experience, BlackBerry Hub
  • 17. HTML5: Media Capture Capture Picture/Video Leverages System Camera app <input type="file" accept="image/*" capture="camera">
  • 18. HTML5 API: Sockets Real-time communication using persistent connections  Frameworks: Socket.io, Pusher.js  E.g. Twitter  Requires server component var url = "ws://my.url.com:8001"; var socket = new WebSocket(url); socket.onmessage = function(e) { displayMessage(e.data); } wordsquared.com
  • 19. HTML5 API: WebGL 3D graphics powered by OpenGL ES  Frameworks: three.js, CopperLicht, SceneJS, GLGE  GPU provides hardware acceleration Tunnel Tilt game  Free download in App World  Source code in Github https://github.com/blackberry/WebGL-Samples
  • 21. WebWorks APIs JavaScript wrappers for OS developer APIs  http://developer.blackberry.com/html5/api  Identity, Invoke, System… Learning resources  http://github.com/blackberry/WebWorks-Samples  See “kitchen sink” sample application for demos
  • 22. BlackBerry 10 WebWorks SDK JavaScript framework, backed by Native C/C++  No longer Java J2ME or Adobe AIR JavaScript packager  Running in Node.js API evolution  W3C/Cordova alignment  Build plan for future move
  • 23. BlackBerry 10 and Ripple Chrome extension Multi-platform support  BlackBerry 10, Tablet OS and BlackBerry OS Build and sign BlackBerry apps
  • 24. Ripple mobile emulator  Development tool for web developers  Preview, test and build BlackBerry web applications  Emulate device-specific APIs and capabilities
  • 25. Remote Web Inspector What is it?  Debug web content running on a remote device.  Profile to optimize web page performance.  Works with simulators or live devices
  • 26. BlackBerry 10 WebWorks APIs blackberry.app blackberry.event blackberry.system blackberry.identity JavaScript C/C++
  • 27. BlackBerry 10 WebWorks <script type="text/javascript" src="webworks.js"></script> function onLoad() { document.addEventListener("webworksready", start); }
  • 28. Config.xml <?xml version="1.0" encoding="UTF-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.100" id="webworkspim" xml:lang="en"> <name>PIM Contacts</name> <author>Research In Motion</author> <content src="index.html"/> <icon src="appicon.png" /> <feature id="blackberry.pim.contacts" />
  • 29. Some recent API additions Invoke  Invoke other apps, card  Be invoked PIM  Contacts  Calendar, Messages on their way BBM  Update profile, invite to download
  • 30. Custom Extensions Building your own WebWorks APIs 30
  • 31. Custom WebWorks APIs Build your own APIs  Access native layer functionality  Go beyond HTML5 and core WebWorks JavaScript interface for platform code  BlackBerry OS = Java Lensboost  Tablet OS = AIR Mblware Ltd  BlackBerry 10 = C/C++
  • 32. Custom WebWorks APIs WebWorks SDK for BlackBerry 10  Platforms = BlackBerry 10  Native language = C/C++ javascript native client.js index.js manifest.json jnext.cpp jnext.hpp
  • 33. Custom WebWorks APIs Open Source  http://github.com/blackberry/WebWorks-Community-APIs  Get started using TEMPLATE sample in Github
  • 34. Resources Places to go, people to see, what’s coming next 34
  • 35. WebWorks Roadmap Frequent releases Incremental APIs, emulation http://developer.blackberry.com/downloads/roadmap
  • 36. For more information http://developer.blackberry.com/html5
  • 37. THANK YOU Jorge del Casar - @jorgecasar February 29, 2013

Hinweis der Redaktion

  1. Originally presented at BlackBerry 10 Jam by: Adam Stanley (RIM) and Ken Wallis (RIM) Re-formatted for a 45 minute presentation: 35 minutes of content and 10 minutes of Q&amp;A (or live demos) Added overview of custom WebWorks extensions.
  2. Talking points: HTML5 is a standard that will continue to evolve for the next 10 years. Its popularity is growing. HTML5 offers native capabilities to Web content (hardware integration and access to device capabilities)
  3. Talking points: All of these applications are free for download from App World (as of May 1, 2012).EconomostTwimbow TIFF Lemma Slacker
  4. Talking points: HTML5 content is powered by WebKit on BlackBerry – any improvements to the WebKit engine automatically benefit Web apps.Though the power of the WebWorks platform this content has access to BlackBerry Developer APIs: HTML5 content powered by native capabilities.
  5. Demo: build sample app using Ripple &amp; WebWorks BB10
  6. Agenda:Intro [10 min] – “Extend HTML5 with WebWorks”Device Capabilities [15 mins] – “Connect HTML5 with native device capabilities”BlackBerry 10 [10 mins]Q &amp; A [10 mins]Suggestion: If there is time at this point, show demos of real apps on a live devicePesktop (PlayBook) or Lensboost (Smartphone) are good examples
  7. Talking points: Storage enables offline access to Web content. Storage enables faster performing web apps (cached content doesn’t need to be re-downloaded).WebDB spec is no longer being worked on (IndexDB is coming but not supported on most platforms).
  8. Talking points: Storage enables offline access to Web content. Storage enables faster performing web apps (cached content doesn’t need to be re-downloaded).WebDB spec is no longer being worked on (IndexDB is coming but not supported on most platforms).
  9. Talking points: The WebKit engine provides default touch event behaviors. Developers can override these behaviors and create their own (e.g. custom swipe gestures, disable pinch-zoom or page scrolling) Very important for BlackBerry 10 Dev Alpha = touch only device.
  10. Talking points: Use physical device movement as a form of user input = great for games.devicemotion event fires in very quick intervals (milliseconds apart) when the device is moving. Aura is a WebWorks sample created by TAT that demonstrates using the accelerometer.
  11. Talking points: Location aware content = contextual experience. Show users content relevant to their location. Can provide (optional) options. Low accuracy = FAST response (cell-site geolocation) ; High accuracy = slower response (satellite) PlayBook supports autonomous GPS (Satellite) and WiFigeolocation (but only if the hotspot is registered with RIM’s geolocation service).
  12. Talking points: Send proactive notifications from your app to the system task bar. Alert users when event(s) happen in your app (e.g. new message, user online, alarm). Great example of HTML5 offering a way to integrate web content with native capabilities.
  13. Talking points: Input types can improve the user experience of your Web apps (e.g. make it easier to enter an email address, or URL) Increases quality of data input received from user (e.g. only want numeric data? Provide user with a numeric keyboard). Types of input fields: text, numeric, URL, email, data, time.
  14. Talking points: Sockets allow you to maintain a persistent connection – means a server can send real-time messages to an application. Apps can communicate to each other through a server (that acts as a dispatch). 3rd party frameworks make this easy.
  15. Talking points: RIM is the first mobile platform to offer WebGL as an application framework to developers. RIM is contributing bug fixes and feature enhancements to community frameworks (e.g. Three.js) Tunnel tilt was created to announce WebGL support on PlayBook.
  16. Agenda:Intro [10 min] – “Extend HTML5 with WebWorks”Device Capabilities [15 mins] – “Connect HTML5 with native device capabilities”BlackBerry 10 [10 mins]Q &amp; A [10 mins]
  17. Talking points: WebWorks SDK has been re-written for BlackBerry 10 – it now uses native C/C++ as its underlying platform. The packager itself is also brand new. Everything is running as JavaScript and node.js is used to generate your compiled BB10 application. The JavaScript signatures / interface of the WebWorks APIs for BB10 are also being modified to align with similar PhoneGap/Cordova APIs. Why? Make it easier for developers to port content between the two platforms.
  18. Talking points: Ripple was recently released again as a Chrome extension. It was originally a Chrome extension, then became a standalone tool and is now back to being an extension. This structure allows the Chrome web engine to evolve on its own, and RIM to easily make over-the-air (OTA) improvements to Ripple for all developers (less upgrades needed!). Ripple extension for chrome supports building apps using the WebWorks SDK.
  19. Talking points: Use the Ripple mobile emulator for previewing how your Web content will look on a real device. Can switch between different device profiles (e.g. Test your Web app on a BB10 Dev Alpha, or PlayBook or even iPad profile). Can switch between different platforms to emulate APIs (e.g. test WebWorks APIs, or PhoneGap/Cordova APIs).
  20. Talking points: BlackBerry is the only platform to offer remote web inspector to developers. Web Inspector is the industry leading debugging solution for HTML5 content. RIM is contributing features into Web Inspector to make it better.
  21. Talking points: 4 APIs were created for initial launch at BB10Jam Orlando. Represent features from most popular app use-cases. JavaScript interface calling native C code.
  22. Talking points: New format for calling WebWorks APIs. All apps must include the new webworks.js file and then wait for the webworksready event before calling a WebWorks API. Existing WebWorks applications will need some work to adjust to this new format.
  23. Talking points: New format for calling WebWorks APIs. All apps must include the new webworks.js file and then wait for the webworksready event before calling a WebWorks API. Existing WebWorks applications will need some work to adjust to this new format.
  24. Talking points: This is a code example of using the new BB10 blackberry.event API. Notice we are working with events and are using the addEventListener() method. This new interface format is very similar to PhoneGap (Cordova).
  25. Talking points: The architecture for custom extensions on the BlackBerry 10 platform is still being finalized. A few APIs have already been produced by RIM, but their internal architecture will change. Instead of J2ME or ActionScript, the underlying code used to implement extensions on BB10 will be Native (C/C++).
  26. Talking points: This is the tentative schedule for BlackBerry 10 WebWorks APIs over summer 2012.This slide will need to be updated throughout the road show as this roadmap evolves.
  27. Agenda:Intro [10 min] – “Extend HTML5 with WebWorks”Device Capabilities [15 mins] – “Connect HTML5 with native device capabilities”BlackBerry 10 [10 mins]Q &amp; A [10 mins]