SlideShare uma empresa Scribd logo
1 de 35
Hands On Lab: BlackBerry WebWorks Bootcamp
                  Alan Wong
              alawong@rim.com
              February 26, 2011
TODAY’S GOAL
Building an application using the BlackBerry WebWorks App Platform
Setup


• This lab will use the following developer tools:
   – Oracle Java Development Kit (JDK) version 1.6
   – BlackBerry WebWorks Packager version 1.5
   – BlackBerry WebWorks Plug-in for Eclipse version 2.5


• Lab Sample Code
   – Starter and Solution Files Source Code
        • Images, HTML + CSS + JavaScript
   – Available on site
First Steps: Create a New Project


 • Open Eclipse
    – Optional: Create a “blackberry” workspace
    – Optional: Open BlackBerry Web/Widget
      Perspective


 • Create a new BlackBerry WebWorks Project
    – File  New  BlackBerry Widget Project
    – Name the project “MyFirstApp”


 • Start a new debugging session
    – Packages and launches application in
      Smartphone simulator
Your First WebWorks Application
UI – Add Visual Resources


 • Keep Simulator Open
 • Back to the MyFirstApp Project in Eclipse
 • Add Images to the project:
    1.   Create “img” folder
         • Right Click Project  New  Other …  General  Folder  “img”
    2.   Import images from Lab Samples Folder
         • Right Click “img” folder  Import  General  File System
         • Browse to <lab samples folder>/ img
         • Select all images and Import
UI - Adding Application Details

• Open the WebWorks Configuration file (config.xml)
   1.   Add application details:
        • Version – “1.0.0.1”
        • Description – “This app was created using BlackBerry WebWorks”
        • Author & Email & Copyright – your name & email & “2011”

   2.   Click Browse button next to Loading Screen  Foreground Image
        • Select the loading.png image
        • Enable “Show on First Launch” and “Show for Local Pages” checkboxes
        • Choose any “Transition Effect” from the “Type” drop down box
        • Set Background Color #: “92CD00”

   3.   Click Browse buttons next to Widget Configuration  Icon/Hover Icon
        • Select the homescreen.png image
UI - Adding Application Details
Application Details - Preview


 • These changes affect how your application appears on the
   BlackBerry Home Screen and System:
Building Blocks of a WebWorks Application


 • HTML
    – Use HTML to create the structure of a screen
 • CSS
    – Use CSS to apply a theme / style to your application
 • JavaScript
    – Use JavaScript to add functionality in your application


 • Index.html
    – By default a WebWorks application loads this page as its starting point
    – Initial launch page can be overridden in config.xml
Step 1: Add HTML


• Add HTML files to the MyFirstApp project
   1.   Right Click Project  Import  General  File System
   2.   Browse to Lab Samples folder
   3.   Select all HTML files:
        • index.html
        • feedback.html
        • selections.html
   4.   Click Finish to import all of these files into the project
   5.   Overwrite index.html file
• Start debug session to preview changes
Step 1: Add HTML - Preview
Step 2: Modify HTML


• Lets add some missing pieces
• Open index.html and feedback.html and selections.html
   – Remove borders from all tables
<table style="width:100%;" cellspacing="0"
          cellpadding="0" border="0">

   – Replace five image placeholders with corresponding <IMG> tags
       • Top:    Left = User.png;   Right = Selections.png
       • Bottom: Left = Feedback.png;   Middle = Calendar.png;   Right =
         Messenger.png

 <td id="shareIcon">
      <!-- Add image here: img/user.png -->
      <img src="img/user.png" class="imgIcon"/>
 </td>
Step 2: Modify HTML - Preview
Step 3: Add CSS


 • Add a CSS file to the MyFirstApp project
    – Right Click Project  File  Import  General  File System
    – Browse to lab samples folder
        • styles.css
    – Import this file into the project


 • Open each of the 3 HTML files
    – Add a reference to the stylesheet at the start of the <HEAD> tag

<head>
   <link type="text/css" rel="stylesheet" href="styles.css"/>
   ...
</head>
Step 3: Add CSS - Preview
Step 4: Modify CSS


 • Lets add some missing pieces
 • Open styles.css
    – Add missing styles to the body definition:

    body { font-family: Helvetica, Arial;
           background-color: #92CD00;
           color: black; padding: 0.5em; }

    – Add missing styles to #pageTitle definition:
    #pageTitle { font-weight: bold;
                 font-size: 200%;
                 text-align: center;
                 vertical-align: middle;
                 background-color: #E5E4D7;
                 border-top: solid 2px #2C6700
                 border-bottom: solid 2px #2C6700}
Step 4: Modify CSS - Preview
Step 5: Add JavaScript


 • Add JavaScript files to the devConWidget project
    – Right Click Project  Import  General  File System
    – Browse to lab samples folder and import the following files:
        • json2.js
        • scripts.js
        • session_data.json

 • Open all three HTML files (index.html, feedback.html,
   selections.html) and add references to these two JavaScript files:
<head>
   <link src="style.css" type="text/css" rel="stylesheet"/>
   <script type="text/javascript" src="json2.js"></script>
   <script type="text/javascript" src="scripts.js"></script>
   ...
</head>
Step 5: Add JavaScript - Review

 • Open and review scripts.js file
 • JavaScript provides application functionality
    – shareWithFriend()
        • New Email screen opened in the Messages application
    – addMenus()
        • When Menu object is selected, a callback JavaScript function is invoked
    – showAbout()
        • Displays application details saved in config.xml
    – checkForUpdates()
        • Launches BlackBerry App World to a specified application page
    – addToCalendar()
        • Create a new pre-filled appointment the Calendar application
Step 5: Add JavaScript - Adding Features

 • What happens if you try to run the app now?
    – Error? This is expected at this point
    – Need to add the JavaScript APIs used to the whitelist.
Step 5: Add JavaScript - Adding Features

 • Open Configuration file (config.xml)
    – Any WebWorks JavaScript APIs used by application must be white listed
    – Add features in the Widget Permissions section of config.xml
    – Runtime errors may occur if features are not properly listed
Step 5: Add JavaScript - Preview

 • User can now click on interactive fields
    – User Icon = Share With a Friend
    – Envelope Icon = Feedback
    – Calendar Icon = Add session details to Calendar
Step 6: Modify JavaScript


 • Lets add some missing pieces
 • Open scripts.js
    – Complete the handleBackKey function (used on all screens):
    function handleBackKey() {
       if (confirm("Would you like to exit?")) {
          blackberry.app.exit();
       }
    }

    – Complete the displaySessionInfo function (used on index.html):
    function displaySessionInfo(id)
    {
       currentSession = new Object();
       currentSession.id = id;

        req = new XMLHttpRequest();
        req.onreadystatechange = handleDisplaySessionInfo;
        req.open('GET', "local:///session_data.json", true);
        req.send(null);
    }
Step 6: Modify JavaScript - Preview
Step 7: Enable Navigation Mode


• Open Configuration file (config.xml)
     – Enable “Use focus-based navigation …”
       checkbox


• Open all 3 HTML files
     – Add focusable property to each of the
       interactive <td> tags
<td id="shareIcon" x-blackberry-focusable="true" onclick="shareWithFriend()">
   <img src="img/user.png" class="imgIcon"/>
</td>

     – index.html: shareIcon, selectIcon,
       feedbackIcon, calendarIcon, messengerIcon
     – feedback.html: shareIcon, homeIcon
     – selections.html: shareIcon, homeIcon
Step 7: Enable Navigation Mode -
Preview

   BEFORE:                           AFTER:
   Default Navigation uses a         Focus Navigation is based on
   pointer to interact with screen   trackpad / trackball movement
Lab Complete

                        Congratulations!
 • You have created a fully working BlackBerry application:
    – Written entirely using Web technologies: HTML, CSS, JavaScript
    – Did not write a single line of Java code
Next Steps – Keep building


 • Explore other WebWorksAPI features
    – Revise and improve the source code created in this lab
    – http://www.blackberry.com/developers/docs/widgetapi


 • Suggestions:
    – Use System API to access system level functions and attributes
    – Proactively send updates to your users using Push API
Next Steps – Code Signing


 • Application must be signed before it can run on a live device
    – Signature keys are files used by the code signing tool
    – Signing process is integrated into the Development tools
    – Purchase keys for a one-time fee from BlackBerry DevZone
    – Testing on a Smartphone simulator does not require code singing




  http://na.blackberry.com/eng/developers/javaappdev/codekeys.jsp
Next Steps – App World Examples


• Submit your WebWorks applications to App World

   http://appworld.blackberry.com/webstore/search/webworks




   All Guitar Chords      Chatmosphere IRC           Hollywood Bowl
Sneak Peek – PlayBook WebWorks

• Re-Build your existing WebWorks applications for PlayBook
   – SDK produces a *.bar application file instead of *.cod
   – Support both BlackBerry platforms with the same source code
   – Attend HOL6 (Tim Neil, Prosanta Bhattacherjee) for more info
Summary

1. BlackBerry Web Plug-in for Eclipse (or Visual Studio 2008)
2. Configuration document is the backbone of a WebWorks app
3. Use JavaScript APIs to access BlackBerry features
4. Distribute your application through App World
For More Information

• BlackBerry Developer Zone:
   – Download BlackBerry development tools & simulators
   – Developer Resource Center
   – Web Community Forum
   – Developers Blog: http://devblog.blackberry.com
   – Twitter: http://twitter.com/BlackBerryDev
   – App World: http://www.blackberry.com/developers/appworld



   http://www.blackberry.com/developers/widget
Thank You
    Alan Wong
alawong@rim.com
February 26, 2011

Mais conteúdo relacionado

Mais procurados

Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Roy de Kleijn
 
Workflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in DrupalWorkflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in Drupalmewren
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5Daniel Fisher
 
( 2 ) Office 2007 Create A Portal
( 2 ) Office 2007   Create A Portal( 2 ) Office 2007   Create A Portal
( 2 ) Office 2007 Create A PortalLiquidHub
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object patternMichael Palotas
 
Automating Ensemble Monitoring and Reporting
Automating Ensemble Monitoring and ReportingAutomating Ensemble Monitoring and Reporting
Automating Ensemble Monitoring and ReportingInterSystems Corporation
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceRicardo Wilkins
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
HoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsHoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsSarah Sexton
 
Lecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationLecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationKobkrit Viriyayudhakorn
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-codeNarayana Reddy
 
7.imaging on windows phone
7.imaging on windows phone7.imaging on windows phone
7.imaging on windows phoneNguyên Phạm
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsMikalai Alimenkou
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionThomas Daly
 

Mais procurados (19)

Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Workflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in DrupalWorkflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in Drupal
 
os-php-wiki5-a4
os-php-wiki5-a4os-php-wiki5-a4
os-php-wiki5-a4
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5
 
( 2 ) Office 2007 Create A Portal
( 2 ) Office 2007   Create A Portal( 2 ) Office 2007   Create A Portal
( 2 ) Office 2007 Create A Portal
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object pattern
 
Automating Ensemble Monitoring and Reporting
Automating Ensemble Monitoring and ReportingAutomating Ensemble Monitoring and Reporting
Automating Ensemble Monitoring and Reporting
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
 
Tutorial 1
Tutorial 1Tutorial 1
Tutorial 1
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
HoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOpsHoloLens Unity Build Pipelines on Azure DevOps
HoloLens Unity Build Pipelines on Azure DevOps
 
Asp.net w3schools
Asp.net w3schoolsAsp.net w3schools
Asp.net w3schools
 
Lecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase AuthenticationLecture 12: React-Native Firebase Authentication
Lecture 12: React-Native Firebase Authentication
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
 
7.imaging on windows phone
7.imaging on windows phone7.imaging on windows phone
7.imaging on windows phone
 
DSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional testsDSL, Page Object and Selenium – a way to reliable functional tests
DSL, Page Object and Selenium – a way to reliable functional tests
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx Version
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 

Semelhante a Hands On Lab: Creating a BlackBerry WebWorks App

XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the BasicsUlrich Krause
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartEric Overfield
 
Establish reliable builds and deployments with Magento
Establish reliable builds and deployments with MagentoEstablish reliable builds and deployments with Magento
Establish reliable builds and deployments with MagentoUnic
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the BasicsUlrich Krause
 
Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAdam Getchell
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps QuicklyGil Irizarry
 
Web app with j query &amp; javascript (5:4)
Web app with j query &amp; javascript (5:4)Web app with j query &amp; javascript (5:4)
Web app with j query &amp; javascript (5:4)Thinkful
 
SPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add insSPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add insNCCOMMS
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUlrich Krause
 
SharePoint - ACME Project
SharePoint - ACME ProjectSharePoint - ACME Project
SharePoint - ACME ProjectMauro_Sist
 
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Lucas Jellema
 
Selenium Training in Chennai Demo Part-2
Selenium Training in Chennai Demo Part-2 Selenium Training in Chennai Demo Part-2
Selenium Training in Chennai Demo Part-2 Thecreating Experts
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_programEyad Almasri
 
Joomla Beginner Template Presentation
Joomla Beginner Template PresentationJoomla Beginner Template Presentation
Joomla Beginner Template Presentationalledia
 

Semelhante a Hands On Lab: Creating a BlackBerry WebWorks App (20)

Advanced Zen
Advanced ZenAdvanced Zen
Advanced Zen
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Establish reliable builds and deployments with Magento
Establish reliable builds and deployments with MagentoEstablish reliable builds and deployments with Magento
Establish reliable builds and deployments with Magento
 
BlackBerry WebWorks
BlackBerry WebWorksBlackBerry WebWorks
BlackBerry WebWorks
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics
 
Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development Management
 
Make Mobile Apps Quickly
Make Mobile Apps QuicklyMake Mobile Apps Quickly
Make Mobile Apps Quickly
 
Web app with j query &amp; javascript (5:4)
Web app with j query &amp; javascript (5:4)Web app with j query &amp; javascript (5:4)
Web app with j query &amp; javascript (5:4)
 
J query ppt
J query pptJ query ppt
J query ppt
 
BackboneJS
BackboneJSBackboneJS
BackboneJS
 
SPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add insSPUnite17 Become a Developer Hero by Building Office Add ins
SPUnite17 Become a Developer Hero by Building Office Add ins
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
 
SharePoint - ACME Project
SharePoint - ACME ProjectSharePoint - ACME Project
SharePoint - ACME Project
 
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
 
Selenium Training in Chennai Demo Part-2
Selenium Training in Chennai Demo Part-2 Selenium Training in Chennai Demo Part-2
Selenium Training in Chennai Demo Part-2
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
Joomla Beginner Template Presentation
Joomla Beginner Template PresentationJoomla Beginner Template Presentation
Joomla Beginner Template Presentation
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 

Mais de momoahmedabad

IoT Testing by Robins Abraham
IoT Testing by Robins AbrahamIoT Testing by Robins Abraham
IoT Testing by Robins Abrahammomoahmedabad
 
Getting Started with IoT by Niraj Shah
Getting Started with IoT by Niraj ShahGetting Started with IoT by Niraj Shah
Getting Started with IoT by Niraj Shahmomoahmedabad
 
Crowd Testing Framework : Mobile Application Testing
Crowd Testing Framework : Mobile Application TestingCrowd Testing Framework : Mobile Application Testing
Crowd Testing Framework : Mobile Application Testingmomoahmedabad
 
Smart Skills For Mobile Developers
Smart Skills For Mobile DevelopersSmart Skills For Mobile Developers
Smart Skills For Mobile Developersmomoahmedabad
 
Localization : The Road Ahead : Kinnari
Localization : The Road Ahead : KinnariLocalization : The Road Ahead : Kinnari
Localization : The Road Ahead : Kinnarimomoahmedabad
 
Localization : The Road Ahead : Anand Virani
Localization : The Road Ahead : Anand ViraniLocalization : The Road Ahead : Anand Virani
Localization : The Road Ahead : Anand Viranimomoahmedabad
 
Localization : The Road Ahead : Mahendra
Localization : The Road Ahead : MahendraLocalization : The Road Ahead : Mahendra
Localization : The Road Ahead : Mahendramomoahmedabad
 
2014 mobile trends_27th Jan
2014 mobile trends_27th Jan2014 mobile trends_27th Jan
2014 mobile trends_27th Janmomoahmedabad
 
Useful Tools for Creating (& not developing) iOS/Android Apps
Useful Tools for Creating (& not developing) iOS/Android AppsUseful Tools for Creating (& not developing) iOS/Android Apps
Useful Tools for Creating (& not developing) iOS/Android Appsmomoahmedabad
 
iPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday AhmedabadiPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday Ahmedabadmomoahmedabad
 
Mobile Monday 03-Jan-2010
Mobile Monday 03-Jan-2010Mobile Monday 03-Jan-2010
Mobile Monday 03-Jan-2010momoahmedabad
 
Mobile monday 12.2010 ahmedabad
Mobile monday 12.2010 ahmedabadMobile monday 12.2010 ahmedabad
Mobile monday 12.2010 ahmedabadmomoahmedabad
 
Indian mobile industry
Indian mobile industryIndian mobile industry
Indian mobile industrymomoahmedabad
 

Mais de momoahmedabad (14)

IoT Testing by Robins Abraham
IoT Testing by Robins AbrahamIoT Testing by Robins Abraham
IoT Testing by Robins Abraham
 
Getting Started with IoT by Niraj Shah
Getting Started with IoT by Niraj ShahGetting Started with IoT by Niraj Shah
Getting Started with IoT by Niraj Shah
 
Crowd Testing Framework : Mobile Application Testing
Crowd Testing Framework : Mobile Application TestingCrowd Testing Framework : Mobile Application Testing
Crowd Testing Framework : Mobile Application Testing
 
Smart Skills For Mobile Developers
Smart Skills For Mobile DevelopersSmart Skills For Mobile Developers
Smart Skills For Mobile Developers
 
Localization : The Road Ahead : Kinnari
Localization : The Road Ahead : KinnariLocalization : The Road Ahead : Kinnari
Localization : The Road Ahead : Kinnari
 
Localization : The Road Ahead : Anand Virani
Localization : The Road Ahead : Anand ViraniLocalization : The Road Ahead : Anand Virani
Localization : The Road Ahead : Anand Virani
 
Localization : The Road Ahead : Mahendra
Localization : The Road Ahead : MahendraLocalization : The Road Ahead : Mahendra
Localization : The Road Ahead : Mahendra
 
2014 mobile trends_27th Jan
2014 mobile trends_27th Jan2014 mobile trends_27th Jan
2014 mobile trends_27th Jan
 
Useful Tools for Creating (& not developing) iOS/Android Apps
Useful Tools for Creating (& not developing) iOS/Android AppsUseful Tools for Creating (& not developing) iOS/Android Apps
Useful Tools for Creating (& not developing) iOS/Android Apps
 
Web works presso
Web works pressoWeb works presso
Web works presso
 
iPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday AhmedabadiPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday Ahmedabad
 
Mobile Monday 03-Jan-2010
Mobile Monday 03-Jan-2010Mobile Monday 03-Jan-2010
Mobile Monday 03-Jan-2010
 
Mobile monday 12.2010 ahmedabad
Mobile monday 12.2010 ahmedabadMobile monday 12.2010 ahmedabad
Mobile monday 12.2010 ahmedabad
 
Indian mobile industry
Indian mobile industryIndian mobile industry
Indian mobile industry
 

Hands On Lab: Creating a BlackBerry WebWorks App

  • 1. Hands On Lab: BlackBerry WebWorks Bootcamp Alan Wong alawong@rim.com February 26, 2011
  • 2. TODAY’S GOAL Building an application using the BlackBerry WebWorks App Platform
  • 3. Setup • This lab will use the following developer tools: – Oracle Java Development Kit (JDK) version 1.6 – BlackBerry WebWorks Packager version 1.5 – BlackBerry WebWorks Plug-in for Eclipse version 2.5 • Lab Sample Code – Starter and Solution Files Source Code • Images, HTML + CSS + JavaScript – Available on site
  • 4. First Steps: Create a New Project • Open Eclipse – Optional: Create a “blackberry” workspace – Optional: Open BlackBerry Web/Widget Perspective • Create a new BlackBerry WebWorks Project – File  New  BlackBerry Widget Project – Name the project “MyFirstApp” • Start a new debugging session – Packages and launches application in Smartphone simulator
  • 5. Your First WebWorks Application
  • 6. UI – Add Visual Resources • Keep Simulator Open • Back to the MyFirstApp Project in Eclipse • Add Images to the project: 1. Create “img” folder • Right Click Project  New  Other …  General  Folder  “img” 2. Import images from Lab Samples Folder • Right Click “img” folder  Import  General  File System • Browse to <lab samples folder>/ img • Select all images and Import
  • 7. UI - Adding Application Details • Open the WebWorks Configuration file (config.xml) 1. Add application details: • Version – “1.0.0.1” • Description – “This app was created using BlackBerry WebWorks” • Author & Email & Copyright – your name & email & “2011” 2. Click Browse button next to Loading Screen  Foreground Image • Select the loading.png image • Enable “Show on First Launch” and “Show for Local Pages” checkboxes • Choose any “Transition Effect” from the “Type” drop down box • Set Background Color #: “92CD00” 3. Click Browse buttons next to Widget Configuration  Icon/Hover Icon • Select the homescreen.png image
  • 8. UI - Adding Application Details
  • 9. Application Details - Preview • These changes affect how your application appears on the BlackBerry Home Screen and System:
  • 10. Building Blocks of a WebWorks Application • HTML – Use HTML to create the structure of a screen • CSS – Use CSS to apply a theme / style to your application • JavaScript – Use JavaScript to add functionality in your application • Index.html – By default a WebWorks application loads this page as its starting point – Initial launch page can be overridden in config.xml
  • 11. Step 1: Add HTML • Add HTML files to the MyFirstApp project 1. Right Click Project  Import  General  File System 2. Browse to Lab Samples folder 3. Select all HTML files: • index.html • feedback.html • selections.html 4. Click Finish to import all of these files into the project 5. Overwrite index.html file • Start debug session to preview changes
  • 12. Step 1: Add HTML - Preview
  • 13. Step 2: Modify HTML • Lets add some missing pieces • Open index.html and feedback.html and selections.html – Remove borders from all tables <table style="width:100%;" cellspacing="0" cellpadding="0" border="0"> – Replace five image placeholders with corresponding <IMG> tags • Top: Left = User.png; Right = Selections.png • Bottom: Left = Feedback.png; Middle = Calendar.png; Right = Messenger.png <td id="shareIcon"> <!-- Add image here: img/user.png --> <img src="img/user.png" class="imgIcon"/> </td>
  • 14. Step 2: Modify HTML - Preview
  • 15. Step 3: Add CSS • Add a CSS file to the MyFirstApp project – Right Click Project  File  Import  General  File System – Browse to lab samples folder • styles.css – Import this file into the project • Open each of the 3 HTML files – Add a reference to the stylesheet at the start of the <HEAD> tag <head> <link type="text/css" rel="stylesheet" href="styles.css"/> ... </head>
  • 16. Step 3: Add CSS - Preview
  • 17. Step 4: Modify CSS • Lets add some missing pieces • Open styles.css – Add missing styles to the body definition: body { font-family: Helvetica, Arial; background-color: #92CD00; color: black; padding: 0.5em; } – Add missing styles to #pageTitle definition: #pageTitle { font-weight: bold; font-size: 200%; text-align: center; vertical-align: middle; background-color: #E5E4D7; border-top: solid 2px #2C6700 border-bottom: solid 2px #2C6700}
  • 18. Step 4: Modify CSS - Preview
  • 19. Step 5: Add JavaScript • Add JavaScript files to the devConWidget project – Right Click Project  Import  General  File System – Browse to lab samples folder and import the following files: • json2.js • scripts.js • session_data.json • Open all three HTML files (index.html, feedback.html, selections.html) and add references to these two JavaScript files: <head> <link src="style.css" type="text/css" rel="stylesheet"/> <script type="text/javascript" src="json2.js"></script> <script type="text/javascript" src="scripts.js"></script> ... </head>
  • 20. Step 5: Add JavaScript - Review • Open and review scripts.js file • JavaScript provides application functionality – shareWithFriend() • New Email screen opened in the Messages application – addMenus() • When Menu object is selected, a callback JavaScript function is invoked – showAbout() • Displays application details saved in config.xml – checkForUpdates() • Launches BlackBerry App World to a specified application page – addToCalendar() • Create a new pre-filled appointment the Calendar application
  • 21. Step 5: Add JavaScript - Adding Features • What happens if you try to run the app now? – Error? This is expected at this point – Need to add the JavaScript APIs used to the whitelist.
  • 22. Step 5: Add JavaScript - Adding Features • Open Configuration file (config.xml) – Any WebWorks JavaScript APIs used by application must be white listed – Add features in the Widget Permissions section of config.xml – Runtime errors may occur if features are not properly listed
  • 23. Step 5: Add JavaScript - Preview • User can now click on interactive fields – User Icon = Share With a Friend – Envelope Icon = Feedback – Calendar Icon = Add session details to Calendar
  • 24. Step 6: Modify JavaScript • Lets add some missing pieces • Open scripts.js – Complete the handleBackKey function (used on all screens): function handleBackKey() { if (confirm("Would you like to exit?")) { blackberry.app.exit(); } } – Complete the displaySessionInfo function (used on index.html): function displaySessionInfo(id) { currentSession = new Object(); currentSession.id = id; req = new XMLHttpRequest(); req.onreadystatechange = handleDisplaySessionInfo; req.open('GET', "local:///session_data.json", true); req.send(null); }
  • 25. Step 6: Modify JavaScript - Preview
  • 26. Step 7: Enable Navigation Mode • Open Configuration file (config.xml) – Enable “Use focus-based navigation …” checkbox • Open all 3 HTML files – Add focusable property to each of the interactive <td> tags <td id="shareIcon" x-blackberry-focusable="true" onclick="shareWithFriend()"> <img src="img/user.png" class="imgIcon"/> </td> – index.html: shareIcon, selectIcon, feedbackIcon, calendarIcon, messengerIcon – feedback.html: shareIcon, homeIcon – selections.html: shareIcon, homeIcon
  • 27. Step 7: Enable Navigation Mode - Preview BEFORE: AFTER: Default Navigation uses a Focus Navigation is based on pointer to interact with screen trackpad / trackball movement
  • 28. Lab Complete Congratulations! • You have created a fully working BlackBerry application: – Written entirely using Web technologies: HTML, CSS, JavaScript – Did not write a single line of Java code
  • 29. Next Steps – Keep building • Explore other WebWorksAPI features – Revise and improve the source code created in this lab – http://www.blackberry.com/developers/docs/widgetapi • Suggestions: – Use System API to access system level functions and attributes – Proactively send updates to your users using Push API
  • 30. Next Steps – Code Signing • Application must be signed before it can run on a live device – Signature keys are files used by the code signing tool – Signing process is integrated into the Development tools – Purchase keys for a one-time fee from BlackBerry DevZone – Testing on a Smartphone simulator does not require code singing http://na.blackberry.com/eng/developers/javaappdev/codekeys.jsp
  • 31. Next Steps – App World Examples • Submit your WebWorks applications to App World http://appworld.blackberry.com/webstore/search/webworks All Guitar Chords Chatmosphere IRC Hollywood Bowl
  • 32. Sneak Peek – PlayBook WebWorks • Re-Build your existing WebWorks applications for PlayBook – SDK produces a *.bar application file instead of *.cod – Support both BlackBerry platforms with the same source code – Attend HOL6 (Tim Neil, Prosanta Bhattacherjee) for more info
  • 33. Summary 1. BlackBerry Web Plug-in for Eclipse (or Visual Studio 2008) 2. Configuration document is the backbone of a WebWorks app 3. Use JavaScript APIs to access BlackBerry features 4. Distribute your application through App World
  • 34. For More Information • BlackBerry Developer Zone: – Download BlackBerry development tools & simulators – Developer Resource Center – Web Community Forum – Developers Blog: http://devblog.blackberry.com – Twitter: http://twitter.com/BlackBerryDev – App World: http://www.blackberry.com/developers/appworld http://www.blackberry.com/developers/widget
  • 35. Thank You Alan Wong alawong@rim.com February 26, 2011