SlideShare a Scribd company logo
Developing Windows Phone 8 Apps using
PhoneGap
Amar Mešić
Senior Software Developer
Source Code d.o.o. Tuzla
Open at
Microsoft
Agenda
• What is PhoneGap, how does it work?
• Setting up IDE for developing WP8 apps
• Common app scenarios
• Fetching data from web (JSON)
• Persistency accross pages
• Bing maps
• Geolocation
• File and local storage
• PhoneGap build
• Porting our apps to another platform
Open at
Microsoft
About PhoneGap
It's an open source framework for building mobile apps using web-
technologies.
• HTML for layout ( Better yet HTML5 )
• JavaScript for accessing device functionality
• CSS for look and feel.
It's a collection of tools + a consistent cross-device API.
• Use the same JavaScript calls to access device functions.
navigator.notification.vibrate();
Open at
Microsoft
About PhoneGap
• Supports development for the following operating systems:
Android, iOS, Windows Phone, webOS, Windows Mobile,
Symbian OS and BlackBerry
• PhoneGap Website: http://phonegap.com/
• Source code available on github
https://github.com/phonegap/
Open at
Microsoft
About Phone Gap?
• The PhoneGap applications are hybrid
• They are neither truly native nor purely web based
• All layout rendering is done via the web view instead of XAML
• Much of the functions of HTML5 are supported
• A disadvantage is that hybrid applications do not have FULL
access to the device API (Camera, compass, accelerometer, etc.)
• PhoneGap is just a library that you must include in your app
(few JavaScript and XML files)
Open at
Microsoft
What does it do?
• PhoneGap generates a out-of-the-browser window that executes
the HTML and JavaScript
• Due to a couple of xml and dll files it enables the usage of native
APIs
• Device API supported by most platforms:
Open at
Microsoft
• GeoLocation
• Compass ( for 3GS )
• Accelerometer
• Telephony
• Camera
• Media Playback + Recording
• Contacts ( read-only )
• Video with HTML5 Video tag
• FileIO ( local application documents
folder )
• Cache images or data from the web
What does it do?
Open at
Microsoft
So PhoneGap apps are just web pages?
Yup, web pages that access device functionality.
• Apps can still provide a rich experience, especially with CSS
transitions and tweening animations.
• CSS Transitions are hardware accelerated !
• There are games built with PhoneGap!
Open at
Microsoft
How is PhoneGap different from a mobile site?
• Mobile websites are domain restricted to their origin url and
cannot access device API
• Apps are loaded from the file://protocol so server requests are
NOT restricted
Pros and cons
Open at
Microsoft
• HTML5, CSS and JavaScript skills vs. C#, Java and Objective-C
• Single code base for all platforms
• Poor performance
• Lack of pre-built UI widgets, standard controls, transitions
• Your development time can take longer
Pros
Cons
Typical PhoneGap app scenario
Open at
Microsoft
• JavaScript calls the server to fetch JSON data.
• HTML/JS/CSS + graphic assets are on the device, packaged as
part of the build process.
• JavaScript can store retrieved data in a SQLite database for
offline access.
• Maps
• Accessing local storage
• Persistent data accross pages
Getting started
Open at
Microsoft
• IDE
• Visual Studio
• Eclipse
• xCode
• Adobe Edge
• Any other editor
• OS SDK
• PhoneGap library
• More tools available at http://phonegap.com/tool
Setting up our environment
Open at
Microsoft
DEM
O
PhoneGap Config file
Open at
Microsoft
• Used for cross-platform configuration and customization (app
capabilities, description, specific platform settings
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.openms"
versionCode="10"
version = "1.0.0">
</widget>
<name>Open at Microsoft</name>
<description>
App description
</description>
UI design
Open at
Microsoft
• jQuery Mobile
• MooTools
• XUI
• jQTouch
• Kendo UI
• PhoneJS
Common app scenarios
Open at
Microsoft
• Fetching data from web (JSON)
• Persistency accross pages
• Bing maps
• Geolocation
• File storage
Fetching data from web service (JSON)
Open at
Microsoft
• HTTPWebRequest & JSON.NET vs jQuery
Bing Maps & Geolocation
Open at
Microsoft
• Map control vs Bing Maps API
• Register on http://bingmapsportal.com to obtain API key for your
app
• Alternative maps:
• Google Maps
• OSM
• CloudMade
Local Database
Open at
Microsoft
• PhoneGap uses SQLite database
• Requires permissions
var db = window.openDatabase(database_name, database_version,
database_displayname, database_size);
db.transaction(populateDB, errorCB, successCB);
• Alternative: use JS with local storage
• CouchDB, TaffyDB, NeDB, PouchDB
• Backbone.js
API Reference
Open at
Microsoft
• File API provides accecss to Isolated Storage
• Connection object gives access to device cellular and wifi info
• Contacts object provides access to
• Events : deviceready, online, offline, backbutton, menubutton
• Device object provides name, platform, version
• Full list of API device funcions available at
http://docs.phonegap.com/
Best practises
Open at
Microsoft
• Main advantage of PhoneGap is you can reuse your web
application source code across platforms.
• A good, quick approach is to write one set of assets and ‘tweak’
across platforms.
• MVC (model-view-controller) paradigm is great for prototyping, as you can revisit
and, if need be, recode particular modules of your app as you iterate.
• Model = PhoneGap JS API + offline storage
• Controller = JavaScript
• View = HTML + CSS
Best practises
Open at
Microsoft
• As you work on an app, you notice repeatable HTML/CSS patterns
that come up. Don’t copy+paste it!
• Encapsulate the view pattern HTML in a JavaScript string
• Mobile devices will not be networked all the time. Bad coverage, on
the plane, no data plan
• PhoneGap offers reachability API
Best practises
Open at
Microsoft
• For small apps, use a single HTML page.
• Use JavaScript to show/hide page elements based on user interaction
instead of linking to a separate page.
• Obfuscate your JavaScript before release.
When NOT to use PhoneGap:
• Complex games, intensive graphics. Use OpenGL for that, not PhoneGap.
• For slower phones. PhoneGap apps using the latest interactive Google
Maps APIs tend to be slow.
PhoneGap Build
Open at
Microsoft
• It allows you to easily build those same mobile apps in the cloud
• Simply upload your www folder or point to GIT/SVN repo
• You can skip build for cetrain platforms using the config.xml file
• No need to install aditional software
• App ready for submission if provided with certificates / signing
keys
Open at
Microsoft
QUESTIONS ?

More Related Content

PPT
How To Create One App For All Platforms using PhoneGap
PPTX
2011 code camp
PPTX
Hybrid Mobile Development
PDF
Building Cross-Platform Mobile Apps with PhoneGap and Sencha Touch
PPT
Cross platform mobile application development
KEY
Phonegap/Cordova vs Native Application
PPTX
Cross platform approach for mobile application development : a survey
PDF
Comparing multi-platform mobile apps frameworks
How To Create One App For All Platforms using PhoneGap
2011 code camp
Hybrid Mobile Development
Building Cross-Platform Mobile Apps with PhoneGap and Sencha Touch
Cross platform mobile application development
Phonegap/Cordova vs Native Application
Cross platform approach for mobile application development : a survey
Comparing multi-platform mobile apps frameworks

What's hot (20)

PDF
Performance testing of mobile apps
PPTX
Introduction to xamarin
PPT
Opening the mobile web mozilla and firefox os-chit thiri maung
PDF
Cross Platform Mobile Development
PPTX
Introduction to Xamarin - Confoo 2015
PPTX
Native Mobile Apps, Xamarin, and PhoneGap
PDF
Cross platform development
PPTX
Cross platform app dev with xamarin forms
PDF
What's new in Blend for Visual Studio 2015
PDF
Cordova + Ionic + MobileFirst
PDF
Understanding the Windows Desktop App Development Landscape + Top 10 WPF Po...
PPTX
Mobile architecture options
PPTX
Rhomobile
PPTX
DNN Connect - Mobile Development With Xamarin
PDF
Cross platform mobile web apps
PPTX
Hybrid App Development with PhoneGap
PPTX
Rhodes vs Phonegap
PPTX
State of the Platforms
PPTX
Cross platform app development with xamarin.forms
PPTX
Building Cross Platform Mobile Apps
Performance testing of mobile apps
Introduction to xamarin
Opening the mobile web mozilla and firefox os-chit thiri maung
Cross Platform Mobile Development
Introduction to Xamarin - Confoo 2015
Native Mobile Apps, Xamarin, and PhoneGap
Cross platform development
Cross platform app dev with xamarin forms
What's new in Blend for Visual Studio 2015
Cordova + Ionic + MobileFirst
Understanding the Windows Desktop App Development Landscape + Top 10 WPF Po...
Mobile architecture options
Rhomobile
DNN Connect - Mobile Development With Xamarin
Cross platform mobile web apps
Hybrid App Development with PhoneGap
Rhodes vs Phonegap
State of the Platforms
Cross platform app development with xamarin.forms
Building Cross Platform Mobile Apps
Ad

Similar to Developing Windows Phone 8 apps using PhoneGap (20)

PDF
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
KEY
Philly ete-2011
KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PDF
PhoneGap Talk @ Sencha Con 2010
KEY
Phone gap
PPTX
Developing cross platform mobile applications with phone gap for windows phone
PPTX
Phone gap development, testing, and debugging
PPTX
All About Phonegap
PPTX
How to build PhoneGap App for Windows Phone?
PPTX
phonegap_101
PPT
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
ODP
What is PhoneGap?
PDF
Building Cross Platform Mobile Web Apps
PPTX
Phonegap - An Overview
PDF
Building cross platform mobile web apps
PDF
Fake Your Way as a Mobile Developer Rockstar with PhoneGap
PDF
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
KEY
Future of Mobile
PPT
PhoneGap
KEY
Intro to PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Philly ete-2011
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PhoneGap Talk @ Sencha Con 2010
Phone gap
Developing cross platform mobile applications with phone gap for windows phone
Phone gap development, testing, and debugging
All About Phonegap
How to build PhoneGap App for Windows Phone?
phonegap_101
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
What is PhoneGap?
Building Cross Platform Mobile Web Apps
Phonegap - An Overview
Building cross platform mobile web apps
Fake Your Way as a Mobile Developer Rockstar with PhoneGap
Cross-Platform Mobile Development with PhoneGap-Vince Bullinger
Future of Mobile
PhoneGap
Intro to PhoneGap
Ad

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
System and Network Administration Chapter 2
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPT
Introduction Database Management System for Course Database
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
AI in Product Development-omnex systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
L1 - Introduction to python Backend.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
VVF-Customer-Presentation2025-Ver1.9.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
System and Network Administration Chapter 2
ManageIQ - Sprint 268 Review - Slide Deck
Design an Analysis of Algorithms II-SECS-1021-03
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Introduction Database Management System for Course Database
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Which alternative to Crystal Reports is best for small or large businesses.pdf
Softaken Excel to vCard Converter Software.pdf
Nekopoi APK 2025 free lastest update
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
AI in Product Development-omnex systems
How to Migrate SBCGlobal Email to Yahoo Easily
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PTS Company Brochure 2025 (1).pdf.......
L1 - Introduction to python Backend.pptx
Design an Analysis of Algorithms I-SECS-1021-03

Developing Windows Phone 8 apps using PhoneGap

  • 1. Developing Windows Phone 8 Apps using PhoneGap Amar Mešić Senior Software Developer Source Code d.o.o. Tuzla Open at Microsoft
  • 2. Agenda • What is PhoneGap, how does it work? • Setting up IDE for developing WP8 apps • Common app scenarios • Fetching data from web (JSON) • Persistency accross pages • Bing maps • Geolocation • File and local storage • PhoneGap build • Porting our apps to another platform Open at Microsoft
  • 3. About PhoneGap It's an open source framework for building mobile apps using web- technologies. • HTML for layout ( Better yet HTML5 ) • JavaScript for accessing device functionality • CSS for look and feel. It's a collection of tools + a consistent cross-device API. • Use the same JavaScript calls to access device functions. navigator.notification.vibrate(); Open at Microsoft
  • 4. About PhoneGap • Supports development for the following operating systems: Android, iOS, Windows Phone, webOS, Windows Mobile, Symbian OS and BlackBerry • PhoneGap Website: http://phonegap.com/ • Source code available on github https://github.com/phonegap/ Open at Microsoft
  • 5. About Phone Gap? • The PhoneGap applications are hybrid • They are neither truly native nor purely web based • All layout rendering is done via the web view instead of XAML • Much of the functions of HTML5 are supported • A disadvantage is that hybrid applications do not have FULL access to the device API (Camera, compass, accelerometer, etc.) • PhoneGap is just a library that you must include in your app (few JavaScript and XML files) Open at Microsoft
  • 6. What does it do? • PhoneGap generates a out-of-the-browser window that executes the HTML and JavaScript • Due to a couple of xml and dll files it enables the usage of native APIs • Device API supported by most platforms: Open at Microsoft • GeoLocation • Compass ( for 3GS ) • Accelerometer • Telephony • Camera • Media Playback + Recording • Contacts ( read-only ) • Video with HTML5 Video tag • FileIO ( local application documents folder ) • Cache images or data from the web
  • 7. What does it do? Open at Microsoft
  • 8. So PhoneGap apps are just web pages? Yup, web pages that access device functionality. • Apps can still provide a rich experience, especially with CSS transitions and tweening animations. • CSS Transitions are hardware accelerated ! • There are games built with PhoneGap! Open at Microsoft How is PhoneGap different from a mobile site? • Mobile websites are domain restricted to their origin url and cannot access device API • Apps are loaded from the file://protocol so server requests are NOT restricted
  • 9. Pros and cons Open at Microsoft • HTML5, CSS and JavaScript skills vs. C#, Java and Objective-C • Single code base for all platforms • Poor performance • Lack of pre-built UI widgets, standard controls, transitions • Your development time can take longer Pros Cons
  • 10. Typical PhoneGap app scenario Open at Microsoft • JavaScript calls the server to fetch JSON data. • HTML/JS/CSS + graphic assets are on the device, packaged as part of the build process. • JavaScript can store retrieved data in a SQLite database for offline access. • Maps • Accessing local storage • Persistent data accross pages
  • 11. Getting started Open at Microsoft • IDE • Visual Studio • Eclipse • xCode • Adobe Edge • Any other editor • OS SDK • PhoneGap library • More tools available at http://phonegap.com/tool
  • 12. Setting up our environment Open at Microsoft DEM O
  • 13. PhoneGap Config file Open at Microsoft • Used for cross-platform configuration and customization (app capabilities, description, specific platform settings <?xml version="1.0" encoding="UTF-8"?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.phonegap.openms" versionCode="10" version = "1.0.0"> </widget> <name>Open at Microsoft</name> <description> App description </description>
  • 14. UI design Open at Microsoft • jQuery Mobile • MooTools • XUI • jQTouch • Kendo UI • PhoneJS
  • 15. Common app scenarios Open at Microsoft • Fetching data from web (JSON) • Persistency accross pages • Bing maps • Geolocation • File storage
  • 16. Fetching data from web service (JSON) Open at Microsoft • HTTPWebRequest & JSON.NET vs jQuery
  • 17. Bing Maps & Geolocation Open at Microsoft • Map control vs Bing Maps API • Register on http://bingmapsportal.com to obtain API key for your app • Alternative maps: • Google Maps • OSM • CloudMade
  • 18. Local Database Open at Microsoft • PhoneGap uses SQLite database • Requires permissions var db = window.openDatabase(database_name, database_version, database_displayname, database_size); db.transaction(populateDB, errorCB, successCB); • Alternative: use JS with local storage • CouchDB, TaffyDB, NeDB, PouchDB • Backbone.js
  • 19. API Reference Open at Microsoft • File API provides accecss to Isolated Storage • Connection object gives access to device cellular and wifi info • Contacts object provides access to • Events : deviceready, online, offline, backbutton, menubutton • Device object provides name, platform, version • Full list of API device funcions available at http://docs.phonegap.com/
  • 20. Best practises Open at Microsoft • Main advantage of PhoneGap is you can reuse your web application source code across platforms. • A good, quick approach is to write one set of assets and ‘tweak’ across platforms. • MVC (model-view-controller) paradigm is great for prototyping, as you can revisit and, if need be, recode particular modules of your app as you iterate. • Model = PhoneGap JS API + offline storage • Controller = JavaScript • View = HTML + CSS
  • 21. Best practises Open at Microsoft • As you work on an app, you notice repeatable HTML/CSS patterns that come up. Don’t copy+paste it! • Encapsulate the view pattern HTML in a JavaScript string • Mobile devices will not be networked all the time. Bad coverage, on the plane, no data plan • PhoneGap offers reachability API
  • 22. Best practises Open at Microsoft • For small apps, use a single HTML page. • Use JavaScript to show/hide page elements based on user interaction instead of linking to a separate page. • Obfuscate your JavaScript before release. When NOT to use PhoneGap: • Complex games, intensive graphics. Use OpenGL for that, not PhoneGap. • For slower phones. PhoneGap apps using the latest interactive Google Maps APIs tend to be slow.
  • 23. PhoneGap Build Open at Microsoft • It allows you to easily build those same mobile apps in the cloud • Simply upload your www folder or point to GIT/SVN repo • You can skip build for cetrain platforms using the config.xml file • No need to install aditional software • App ready for submission if provided with certificates / signing keys