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

What's hot (20)

PDF
Performance testing of mobile apps
vodQA
 
PPTX
Introduction to xamarin
Alejandro Ruiz Varela
 
PPT
Opening the mobile web mozilla and firefox os-chit thiri maung
Chit Thiri Maung
 
PDF
Cross Platform Mobile Development
Software Infrastructure
 
PPTX
Introduction to Xamarin - Confoo 2015
Guy Barrette
 
PPTX
Native Mobile Apps, Xamarin, and PhoneGap
Sasha Goldshtein
 
PDF
Cross platform development
dftaiwo
 
PPTX
Cross platform app dev with xamarin forms
Shahriar Hossain
 
PDF
What's new in Blend for Visual Studio 2015
Fons Sonnemans
 
PDF
Cordova + Ionic + MobileFirst
Raymond Camden
 
PDF
Understanding the Windows Desktop App Development Landscape + Top 10 WPF Po...
MSDEVMTL
 
PPTX
Mobile architecture options
johnsprunger
 
PPTX
Rhomobile
Abhishek Nalwaya
 
PPTX
DNN Connect - Mobile Development With Xamarin
Mark Allan
 
PDF
Cross platform mobile web apps
James Pearce
 
PPTX
Hybrid App Development with PhoneGap
Dotitude
 
PPTX
Rhodes vs Phonegap
Ankit Shandilya
 
PPTX
State of the Platforms
Sasha Goldshtein
 
PPTX
Cross platform app development with xamarin.forms
Shahriar Hossain
 
PPTX
Building Cross Platform Mobile Apps
Shailendra Chauhan
 
Performance testing of mobile apps
vodQA
 
Introduction to xamarin
Alejandro Ruiz Varela
 
Opening the mobile web mozilla and firefox os-chit thiri maung
Chit Thiri Maung
 
Cross Platform Mobile Development
Software Infrastructure
 
Introduction to Xamarin - Confoo 2015
Guy Barrette
 
Native Mobile Apps, Xamarin, and PhoneGap
Sasha Goldshtein
 
Cross platform development
dftaiwo
 
Cross platform app dev with xamarin forms
Shahriar Hossain
 
What's new in Blend for Visual Studio 2015
Fons Sonnemans
 
Cordova + Ionic + MobileFirst
Raymond Camden
 
Understanding the Windows Desktop App Development Landscape + Top 10 WPF Po...
MSDEVMTL
 
Mobile architecture options
johnsprunger
 
Rhomobile
Abhishek Nalwaya
 
DNN Connect - Mobile Development With Xamarin
Mark Allan
 
Cross platform mobile web apps
James Pearce
 
Hybrid App Development with PhoneGap
Dotitude
 
Rhodes vs Phonegap
Ankit Shandilya
 
State of the Platforms
Sasha Goldshtein
 
Cross platform app development with xamarin.forms
Shahriar Hossain
 
Building Cross Platform Mobile Apps
Shailendra Chauhan
 

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

PDF
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
KEY
Phone gap
Kevin Lee
 
PPTX
phonegap_101
Asanka Indrajith
 
PPTX
An overview of mobile html + java script frameworks
Sasha dos Santos
 
ODP
Synapse india reviews on mobile application development
saritasingh19866
 
PDF
Cordova and PhoneGap Insights
Monaca
 
PPTX
Top 4 Cross Platform tools for Mobile App Development
techugo
 
KEY
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
PDF
Getting started with PhoneGap
Mihai Corlan
 
PDF
Cross Platform Mobile Development
Manesh Lad
 
PDF
PhoneGap/Cordova
Mihai Corlan
 
PDF
HTML5 or Android for Mobile Development?
Reto Meier
 
PPT
Making the Mobile Web Native with PhoneGap
Roy Clarkson
 
KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
 
PDF
Development Workshop on ET1, Android and Motorola RhoElements
Romin Irani
 
PPT
PhoneGap
Doncho Minkov
 
PDF
[2015/2016] Apache Cordova
Ivano Malavolta
 
PDF
Anatomy of an HTML 5 mobile web app
Ivano Malavolta
 
PPTX
Xamarin COE by Mukteswar Patnaik
Mukteswar Patnaik
 
PPTX
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Ryan Cuprak
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
Phone gap
Kevin Lee
 
phonegap_101
Asanka Indrajith
 
An overview of mobile html + java script frameworks
Sasha dos Santos
 
Synapse india reviews on mobile application development
saritasingh19866
 
Cordova and PhoneGap Insights
Monaca
 
Top 4 Cross Platform tools for Mobile App Development
techugo
 
Mobile ECM with JavaScript - JSE 2011
Nuxeo
 
Getting started with PhoneGap
Mihai Corlan
 
Cross Platform Mobile Development
Manesh Lad
 
PhoneGap/Cordova
Mihai Corlan
 
HTML5 or Android for Mobile Development?
Reto Meier
 
Making the Mobile Web Native with PhoneGap
Roy Clarkson
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
davyjones
 
Development Workshop on ET1, Android and Motorola RhoElements
Romin Irani
 
PhoneGap
Doncho Minkov
 
[2015/2016] Apache Cordova
Ivano Malavolta
 
Anatomy of an HTML 5 mobile web app
Ivano Malavolta
 
Xamarin COE by Mukteswar Patnaik
Mukteswar Patnaik
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Ryan Cuprak
 
Ad

Recently uploaded (20)

PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
PDF
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Dipole Tech Innovations – Global IT Solutions for Business Growth
dipoletechi3
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Ad

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