SlideShare une entreprise Scribd logo
1  sur  26
Cordova: Using Your Web Skills
to Create Native Mobile Apps


                   Clay Ewing
Me?
• I teach here, at UM
  – Interactive MFA starting Fall 2013
• Web & Mobile Developer
• Game Designer
Cordova, aka PhoneGap
What is it?
• Framework for building mobile
  applications in HTML
• Allows access to native functions through
  JavaScript, like
  GPS, accelerometer, camera, etc.
  – http://docs.phonegap.com/en/2.3.0
Why Use It?
• Quick, no need to learn another
  language
• Cross platform compatible, minimal
  effort to make an app available on
  multiple mobile devices
• Open source
• Sell your app in a store
How does it work?
• Modern smart phone operating systems
  have their version of a webview
• Cordova is literally just a local web page
  seen through a full screen webview
• Plugins use device specific code
  (Objective C, Java, etc) to access
  functions through JavaScript
Plugins?
• A bunch of features are packed in
  automatically:
  – http://docs.phonegap.com/en/edge
• Community based plugins that focus on
  device OS specific stuff:
  – https://github.com/phonegap/phonegap-
    plugins
Let’s make an app!




http://www.github.com/claytical/magic8
Getting Started
• You need whatever IDE and SDK you
  would normally need.
  – iOS requires Xcode and the iOS SDK
    (https://developer.apple.com/)
  – Android requires Eclipse and the Android
    SDK (http://developer.android.com/sdk)
Look and Feel
• jQuery Mobile
  – http://jquerymobile.com
• Dojo
  – http://dojotoolkit.org
• Sencha Touch
  – http://www.sencha.com/products/touch
• iUI
  – http://www.iui-js.org/
Actually Getting Started
• Download the latest build
  – http://cordova.apache.org/#download
• Extract the zip file to wherever you want
  it
• Extract the zip file inside the zip file
  corresponding to the device you’re
  targeting
Unzipped iOS
Create the Project in Terminal
• For iOS, run:
  – bin/create <ProjectDirectory>
    <Namespace> <ProjectName>

  – bin/create
    “/Users/clay/Documents/CordovaExample”
    com.example.magic_8 Magic8
What the Command Creates




  Our focus:
A Little HTML
<h1>Magic 8 Ball</h1>
    <div id="asking">

          <textarea id="question" name="question" class="full" placeholder="To what
question do you seek the answer to?"></textarea>

         <button id="ask" class="gradient-button purple full">Ask</button>
      </div>

      <div id="answering" style="display:none">

        <div id="answer"></div>

        <button id="askagain" class="gradient-button purple full">Ask Again</button>
        <button id="newquestion" class="gradient-button purple full">New Q</button>
        <button id="share" class="gradient-button purple full">Share Results</button>
        <button id="tweet" class="gradient-button purple full">Tweet Results</button>

      </div>
Some CSS3 for Buttons
.gradient-button {
          display: inline-block;
          outline: none;
          cursor: pointer;
          text-align: center;
          text-decoration: none;
          font: 15px/100% Arial, Helvetica, sans-serif;
          padding: .5em 2em .55em;
          text-shadow: 0 1px 1px rgba(0,0,0,.3);
          -webkit-border-radius: .5em;
          border-radius: .5em;
          -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
          box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.gradient-button:active {
          position: relative;
          top: 1px;
}
Make a Purple Button
.purple {
       color: #fef4e9;
       border: solid 1px #551A8B;
       background: #8A2BE2;
       background: -webkit-gradient(linear, left top, left
bottom, from(#8A2BE2), to(#551A8B));
}

.purple:active {
       color: #fef4e9;
       background: -webkit-gradient(linear, left top, left
bottom, from(#551A8B), to(#694489));
}
The JavaScript
• Clean up index.js
  – It has some extra stuff we don’t need
• Add zepto.js for easy manipulation
  – You can use whatever framework you like
• Add social.js for our Social Framework
  Plugin
  – This is iOS specific
Some More JavaScript
var answers = ['It is certain', 'It is decidedly so', 'Without a doubt', 'Yes –
definitely', 'You may rely on it', 'As I see it, yes', 'Most likely’];

       function getAnswer() {
         $('#asking').hide();
         $('#answering').show();
         var selectedResponse = Math.floor((Math.random()*20));
         $('#answer').text(answers[selectedResponse]);
       }

       function newQuestion() {
         $('#question').val("");
         $('#asking').show();
         $('#answering').hide();

       }
Plugins? No problem.
• Place the m and h files into the plugins
  folder

• Copy the js file into the www/js folder


• Add extra frameworks to the project

• Add a line to
    config.xml
Use the Plugin with JavaScript
function fbResults() {
         var qa = $('#question').val() + " " + $('#answer').text() + "
#magic8";
         SocialFrameworkPlugin.postToFacebook( shareSuccess,
shareError, qa);

}

function shareSuccess() {
   console.log("Sharing Successful");
 }

function shareError() {
   console.log("Error sharing");
}
Icons and Splash Screens
And Build.
Adobe PhoneGap Build
• Streamline the process of building for
  other platforms
• No need to own a mac to build an iOS
  app
• Free for open source projects
• Private repositories require a
  subscription
  – $12/month for 3 private apps
Adobe PhoneGap Build
Questions?



              Clay Ewing
       www.claytical.com
 www.github.com/claytical
     c.ewing@miami.edu
               @claytical

Contenu connexe

Tendances

jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 

Tendances (20)

jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScriptjQTouch – Mobile Web Apps with HTML, CSS and JavaScript
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
 
Deep dive into AngularJs for Beginners
Deep dive into AngularJs for BeginnersDeep dive into AngularJs for Beginners
Deep dive into AngularJs for Beginners
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 
Joomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesJoomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiences
 
Mobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery MobileMobile Apps with PhoneGap and jQuery Mobile
Mobile Apps with PhoneGap and jQuery Mobile
 
Angular Classy
Angular ClassyAngular Classy
Angular Classy
 
Beginning jQuery Mobile
Beginning jQuery MobileBeginning jQuery Mobile
Beginning jQuery Mobile
 
AppForum 2014 Boost Hybrid App Performance
AppForum 2014 Boost Hybrid App PerformanceAppForum 2014 Boost Hybrid App Performance
AppForum 2014 Boost Hybrid App Performance
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
Untangling the web10
Untangling the web10Untangling the web10
Untangling the web10
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
Ember At Scale
Ember At ScaleEmber At Scale
Ember At Scale
 
Untangling the web11
Untangling the web11Untangling the web11
Untangling the web11
 
A Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for WicketA Simple Plugin Architecture for Wicket
A Simple Plugin Architecture for Wicket
 
Ember Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with EmberEmber Conf 2016: Building Mobile Apps with Ember
Ember Conf 2016: Building Mobile Apps with Ember
 
Untangling7
Untangling7Untangling7
Untangling7
 
Build 2017 - B8002 - Introducing Adaptive Cards
Build 2017 - B8002 - Introducing Adaptive CardsBuild 2017 - B8002 - Introducing Adaptive Cards
Build 2017 - B8002 - Introducing Adaptive Cards
 
Configuration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL PluginConfiguration as Code: The Job DSL Plugin
Configuration as Code: The Job DSL Plugin
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 
Using Features
Using FeaturesUsing Features
Using Features
 

Similaire à Cordova: Making Native Mobile Apps With Your Web Skills

Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateev
Mihail Mateev
 

Similaire à Cordova: Making Native Mobile Apps With Your Web Skills (20)

Mobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to NativeMobile Vue.js – From PWA to Native
Mobile Vue.js – From PWA to Native
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
React nativebeginner1
React nativebeginner1React nativebeginner1
React nativebeginner1
 
Introduction phonegap
Introduction phonegapIntroduction phonegap
Introduction phonegap
 
Advanced programing in phonegap
Advanced programing in phonegapAdvanced programing in phonegap
Advanced programing in phonegap
 
Ignite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and FirebaseIgnite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and Firebase
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
Adobe & HTML5
Adobe & HTML5Adobe & HTML5
Adobe & HTML5
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript AppsBusy Developer's Guide to Windows 8 HTML/JavaScript Apps
Busy Developer's Guide to Windows 8 HTML/JavaScript Apps
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhone
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Node azure
Node azureNode azure
Node azure
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScript
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8
 
Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateev
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflow
 
Lessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeLessons from a year of building apps with React Native
Lessons from a year of building apps with React Native
 
Ionic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile appsIonic Framework - get up and running to build hybrid mobile apps
Ionic Framework - get up and running to build hybrid mobile apps
 
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
 

Plus de Clay Ewing

Defining games feedback
Defining games   feedbackDefining games   feedback
Defining games feedback
Clay Ewing
 
CVJ531: Intro to MySQL
CVJ531: Intro to MySQLCVJ531: Intro to MySQL
CVJ531: Intro to MySQL
Clay Ewing
 

Plus de Clay Ewing (9)

Hypothesis Tested: Designing Games with Theoretical Frameworks
Hypothesis Tested: Designing Games with Theoretical FrameworksHypothesis Tested: Designing Games with Theoretical Frameworks
Hypothesis Tested: Designing Games with Theoretical Frameworks
 
Game Design Workshop for SEEDS at the University of Miami
Game Design Workshop for SEEDS at the University of MiamiGame Design Workshop for SEEDS at the University of Miami
Game Design Workshop for SEEDS at the University of Miami
 
Getting Started with Queso
Getting Started with QuesoGetting Started with Queso
Getting Started with Queso
 
Twine Workshop
Twine WorkshopTwine Workshop
Twine Workshop
 
Win Win: Models for Creating a Social Impact Game on a Budget
Win Win: Models for Creating a Social Impact Game on a BudgetWin Win: Models for Creating a Social Impact Game on a Budget
Win Win: Models for Creating a Social Impact Game on a Budget
 
Game Design dorkShop at LAB Miami
Game Design dorkShop at LAB MiamiGame Design dorkShop at LAB Miami
Game Design dorkShop at LAB Miami
 
Defining games feedback
Defining games   feedbackDefining games   feedback
Defining games feedback
 
CVJ531: Intro to MySQL
CVJ531: Intro to MySQLCVJ531: Intro to MySQL
CVJ531: Intro to MySQL
 
Welcome to CMP 394
Welcome to CMP 394Welcome to CMP 394
Welcome to CMP 394
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
 

Dernier (20)

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, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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...
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"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 ...
 
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
 

Cordova: Making Native Mobile Apps With Your Web Skills

  • 1. Cordova: Using Your Web Skills to Create Native Mobile Apps Clay Ewing
  • 2. Me? • I teach here, at UM – Interactive MFA starting Fall 2013 • Web & Mobile Developer • Game Designer
  • 4. What is it? • Framework for building mobile applications in HTML • Allows access to native functions through JavaScript, like GPS, accelerometer, camera, etc. – http://docs.phonegap.com/en/2.3.0
  • 5. Why Use It? • Quick, no need to learn another language • Cross platform compatible, minimal effort to make an app available on multiple mobile devices • Open source • Sell your app in a store
  • 6. How does it work? • Modern smart phone operating systems have their version of a webview • Cordova is literally just a local web page seen through a full screen webview • Plugins use device specific code (Objective C, Java, etc) to access functions through JavaScript
  • 7. Plugins? • A bunch of features are packed in automatically: – http://docs.phonegap.com/en/edge • Community based plugins that focus on device OS specific stuff: – https://github.com/phonegap/phonegap- plugins
  • 8. Let’s make an app! http://www.github.com/claytical/magic8
  • 9. Getting Started • You need whatever IDE and SDK you would normally need. – iOS requires Xcode and the iOS SDK (https://developer.apple.com/) – Android requires Eclipse and the Android SDK (http://developer.android.com/sdk)
  • 10. Look and Feel • jQuery Mobile – http://jquerymobile.com • Dojo – http://dojotoolkit.org • Sencha Touch – http://www.sencha.com/products/touch • iUI – http://www.iui-js.org/
  • 11. Actually Getting Started • Download the latest build – http://cordova.apache.org/#download • Extract the zip file to wherever you want it • Extract the zip file inside the zip file corresponding to the device you’re targeting
  • 13. Create the Project in Terminal • For iOS, run: – bin/create <ProjectDirectory> <Namespace> <ProjectName> – bin/create “/Users/clay/Documents/CordovaExample” com.example.magic_8 Magic8
  • 14. What the Command Creates Our focus:
  • 15. A Little HTML <h1>Magic 8 Ball</h1> <div id="asking"> <textarea id="question" name="question" class="full" placeholder="To what question do you seek the answer to?"></textarea> <button id="ask" class="gradient-button purple full">Ask</button> </div> <div id="answering" style="display:none"> <div id="answer"></div> <button id="askagain" class="gradient-button purple full">Ask Again</button> <button id="newquestion" class="gradient-button purple full">New Q</button> <button id="share" class="gradient-button purple full">Share Results</button> <button id="tweet" class="gradient-button purple full">Tweet Results</button> </div>
  • 16. Some CSS3 for Buttons .gradient-button { display: inline-block; outline: none; cursor: pointer; text-align: center; text-decoration: none; font: 15px/100% Arial, Helvetica, sans-serif; padding: .5em 2em .55em; text-shadow: 0 1px 1px rgba(0,0,0,.3); -webkit-border-radius: .5em; border-radius: .5em; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2); box-shadow: 0 1px 2px rgba(0,0,0,.2); } .gradient-button:active { position: relative; top: 1px; }
  • 17. Make a Purple Button .purple { color: #fef4e9; border: solid 1px #551A8B; background: #8A2BE2; background: -webkit-gradient(linear, left top, left bottom, from(#8A2BE2), to(#551A8B)); } .purple:active { color: #fef4e9; background: -webkit-gradient(linear, left top, left bottom, from(#551A8B), to(#694489)); }
  • 18. The JavaScript • Clean up index.js – It has some extra stuff we don’t need • Add zepto.js for easy manipulation – You can use whatever framework you like • Add social.js for our Social Framework Plugin – This is iOS specific
  • 19. Some More JavaScript var answers = ['It is certain', 'It is decidedly so', 'Without a doubt', 'Yes – definitely', 'You may rely on it', 'As I see it, yes', 'Most likely’]; function getAnswer() { $('#asking').hide(); $('#answering').show(); var selectedResponse = Math.floor((Math.random()*20)); $('#answer').text(answers[selectedResponse]); } function newQuestion() { $('#question').val(""); $('#asking').show(); $('#answering').hide(); }
  • 20. Plugins? No problem. • Place the m and h files into the plugins folder • Copy the js file into the www/js folder • Add extra frameworks to the project • Add a line to config.xml
  • 21. Use the Plugin with JavaScript function fbResults() { var qa = $('#question').val() + " " + $('#answer').text() + " #magic8"; SocialFrameworkPlugin.postToFacebook( shareSuccess, shareError, qa); } function shareSuccess() { console.log("Sharing Successful"); } function shareError() { console.log("Error sharing"); }
  • 22. Icons and Splash Screens
  • 24. Adobe PhoneGap Build • Streamline the process of building for other platforms • No need to own a mac to build an iOS app • Free for open source projects • Private repositories require a subscription – $12/month for 3 private apps
  • 26. Questions? Clay Ewing www.claytical.com www.github.com/claytical c.ewing@miami.edu @claytical