SlideShare una empresa de Scribd logo
1 de 23
Building Mobile Web Apps with
jQM and Cordova on Azure
Brian Lyttle
May 12, 2012
Thanks to our sponsors!




 Complete the session and event evaluations to win an XBOX 360!
Today
What you should get from this presentation



                                                                     •     A broad talk for people who are
                    •How the Azure platform can support mobile             interested in mobile apps with HTML5.
                     development.                                          I‟m not providing complete step-by-
     Cloud          •Issues with transitioning apps and data to
                                                                     •
                                                                           step walkthroughs.
                     Azure.
                                                                     •     Instead I‟ll be focusing on issues
                                                                           encountered and how they were dealt
                                                                           with.
                    •Framework choices

    Mobile          •An understanding of the issues encountered
                     when building hybrid apps.
                                                                                  Shared pain vs. project-specific pain

                    •Integration issues with 3rd party libraries.




                    •Tips for debugging HTML5 mobile apps on
 Techniques          Windows.
                    •Packaging apps for deployment.
                                                                    Pain




                                                                                      Focus



                                                                                                 Time
About me

• Brian Lyttle
    – Solution Architect at LiquidHub
• E-mail
    – blyttle@liquidhub.com
• Interwebs
    – @brianly on Twitter
    – @brianly on Stack Overflow
    – Blog infrequently at http://brianlyttle.com
Background

• NextBigThink
   – LiquidHub‟s annual developer competition

• Guilty parties
   – Rajat Sen (Java Dude)
   – Steve DiBello (LINQ Maven)
   – Brian Lyttle (Mobile Dilettante)

• Challenge
   – Build a healthcare demo to support mobile case workers.
   – Experiment with any technology you think you might need on a future
     project.

• MobiNurse
   – A “CRM” app for nurses or case workers.
Requirements

Functional                            Initial concept with jQTouch
• Information forms for each
  patient.
• Listing of assigned patients.
• Find a specialist map.
• Contact a specialist.
• Signature capture.
• Claim submission.
• User registration.
• Password recovery.

Technical
• Simple password protection.
• Minimized data transfer.
• Available via a webpage or an app
  installed on a device.
• Support iOS and Android.
Architecture
What we built and how we put it together


     User Experience                       Architecture   Components
Data Tier

Storage options on Azure
• SQL Database
• Table Storage
• Queue
• Windows Azure Drive

A relational database makes most
sense for a CRM app
• The exception being BLOB storage
  for signatures.

Tool support
• SQL Server Management Studio can
  connect.
• Only a partial set of on-premise
  functionality is available.
• Data Sync is available.

Docs at https://www.windowsazure.com/en-
us/develop/net/how-to-guides/sql-azure/
Web Tier

HTTP Service options on Azure
• ASP.NET MVC
• Nancy Framework
• WCF Data Services

We wanted to spend more time on
the mobile app - so we went with
WCF DS
• It was really easy to expose our
  SQL database via the web

Tool support
• Model designer support in Visual
  Studio.
• URLs are easily hacked for query
  development.
• Data exposed as XML or JSON.
Docs at http://msdn.microsoft.com/en-us/data/bb931106
Client Tier

HTML5 options
• Roll our own
• jQuery
• jQTouch (not part of jQuery)
• jQuery Mobile (official!)
• Sencha Touch

We started out with jQTouch, but
reversed that decision
• jQuery Mobile proved to be the
  most consistent and easiest to
  integrate with 3rd party libs.

Tool support
• Safari and Chrome share an
  excellent set of developer tools.
• Plugins for Xcode and Eclipse
  enabled easy offline packaging.
Azure Developer Fabric (DevFC.exe) crashes

Problem
• DevFC.exe crashes when you start to
  debug a project.

Solution
• Check if VMware Workstation is installed
  on your machine.
• VMW has a service called “vmware-
  hostd.exe” which uses port 12001.
• DevFC.exe crashes when it fails to bind to
  this port.
• Stop the “VMware Workstation Server”
  service.
Azure Deployment

Problem
• Azure deployment is slow.
• Your mobile app is in a separate location from your web tier.
• Cross-domain issues crop up with data access.

Solutions
• Copy all of the HTML and other assets into your ASP.NET MVC 3 Web Role
  project.
• Deploy it all together for speed and to reduce cost.
• Alternatively use JSONP to request data from a different location.
• Develop the mobile app inside a browser you control (Cordova).

Resources
• Windows Azure PowerShell Cmdlets
• JSONP and URL-controlled format support for ADO.NET Data Services
Getting data in and out of SQL Azure

Problems
• You can‟t connect with SQL Server Management Studio (SSMS)
• When connected to just SQL Azure you have limited functionality available in
  SSMS.

Solutions
• Export SQL Scripts for everything.
• Migrate using the MS Sync Framework.
• Data tier import/export with WAPMMC.
• SQL Server Import and Export Wizard.
• SQL Azure Migration Wizard (community supported)

Resources
• Migrating Databases to SQL Azure (SQL Azure Database)
• Windows Azure Platform Management Tool (WAPMMC)
File I/O on Azure

 Problem
 • Your legacy ASP.NET application reads or
   writes some files on disk.
 • File access results in exceptions and files
   are gone after deployment.

 Solutions
 • Try using Local Storage initially.
 • Move to Queues, Blob Storage, Table Storage, SQL Azure if you need:
     – It to be long lived.
     – To access the files from other instances.
 • Broad file write access is only possible from an elevated Startup Task.

 Resources
 • Windows Azure Local File Storage - How To Guide and Warnings
 • Azure FAQ: Can I write to the file system on Windows Azure?
Azure Emulator access

Problem
• You have a mobile device for testing.
• A change has been made to the Azure and you want to preview it without deploying
  to the cloud.
• There is a good chance you want to debug some ASP.NET MVC code.

Solutions
• Avoid debugging from devices and rely on the desktop browsers.
• I never found a clean solution to this issue despite asking on StackOverflow.
• What I do is:
    – Open the IIS Manager
    – Find the site that Azure is using for hosting.
    – Modify that site so that you can access from another computer, making sure you
        allow it through any firewalls.
    – Connect your mobile device to the same network.
Resources
• Is it possible to access the Azure emulator from another computer on the same
  network?
Know your events

Problem
• I‟ve used jQuery before but weird things are happening.

Solution
• Review the documentation for changes to the event handling.
• Changes were necessary to support touch, and to support the way that jQM
  loads pages using AJAX.
• Use $(document).bind('pageinit'), not $(document).ready()
• New events include tap, taphold, swipe, swipeleft, and swiperight.
• Page navigation loads pages without executing the contents of <head>.
    – Account for situations where a user refreshes the page, or receives a link to
      a page.

Resources
• jQuery Mobile Docs: Events
Debugging jQM on Windows

Problem                                                    Debugger Commands
• You have some JavaScript code in your mobile             debugger;   // break into the
  application that you want to step through or inspect.                // debugger


Solution                                                   // output data
                                                           console.log(string)
• Run the solution in IE with the “F12 Developer Tools”.   console.info(string)
• Run the solution in Safari or Chrome and open their      console.warn(string)
  developer tools.                                         console.error(string)
    – With this project we found Safari to be better
      even though both use WebKit.                         // inspect JS objects
                                                           object
    – In particular, the Geolocation features worked
      better.

Resources
                                                           // inspect elements
• Chrome Developer Tools: Overview                         // (First select an element)
• How to use F12 Developer Tools to Debug your             dir($0)
  Webpages
• Android - Debugging Web Apps
Event handling duplication with jQM

 Problem
 • We ended up with lots of repeated
   code for event handling.             // This gets ugly after a while

                                        $('.cases-all').live("pagecreate", function() {
                                           // code
 Solutions                              });
 • Investigate client MVC frameworks.
                                        $('.cases-assigned').live("pagecreate", function() {
 • Popular frameworks:                     // code

     – backbone.js                      });


     – JavaScriptMVC                    $('.case-search').live("pageinit", function() {
                                           // code
                                        });

 Resources
 • Building Large-Scale jQuery
   Applications
 • Using Backbone.js with jQuery
   Mobile
Cache Busting

Problem
• Mobile browsers like to minimize data usage and are over zealous with caching.

Solution
• Add some unique junk as a query string parameter during development.
• Make sure to remove it when you deploy to production!

   function cacheBuster() {
       return '&_cb' + Math.round(new Date().getTime());
   }
Google Maps integration

Problem
• You are struggling with getting Google Maps API V3 running with your app.

Solution
• Check the jQM source tree for updates to the sample.
• Make sure the Google scripts are loaded if you navigate from another page.
  <head> only loads if you refresh the page.

Resources
• Using Debugging Tools with the Google Maps API
Packaging

Problem
• Your mobile application runs great via the mobile browser, but you want to run it
  offline too.

Solutions
• Start by looking into HTML5 Web Storage. This is the foundation.
• Apache Cordova (formerly PhoneGap) enables you package an HTML5 application in a
  native format for a device.
    – Enables access to native-only features like Contacts and the Camera.
    – Native to JS bridges are possible through plugins.
• PhoneGap Build and Sencha SDK simplify this.
• Make sure that you allow requests to the required hosts e.g. *.server.com.
• We were able to power our mobile web and Cordova apps with the same HTML.

Resources
• Cordova: Getting started with iOS
• Cordova: Getting started with Android
Wrap up

Azure                                    Hybrid Apps
• Makes a lot of sense if you have an    • jQuery Mobile is great for getting
  in-house ASP.NET application.            started in this area as the markup
• Possibly overkill if you just need a     is simple.
  backend for prototyping.               • Sencha Touch offers better
• WCF DS is really simple                  performance across a smaller set
                                           of devices but is mostly JS-driven.
Backend as a Service                     • HTML5 solutions can work well
                                           across platforms but iOS tends to
• New SaaS category                        perform a little better (cf.
    – Parse                                transitions).
    – Urban Airship                      • LinkedIn replaced their iOS app
• Additional cost and limited              with one written in HTML5, so
  flexibility.                             even premium apps are starting to
                                           go down this route.
Thanks
Don‟t forget to complete your evaluations


Slides                                      Related talks today

                                            From Command Line to Cloud:
Will be posted to                           Developer Tools for Cloud Agility in
http://brianlyttle.com shortly.             Visual Studio 2012 (Matthew
                                            Ammerman)

Got questions?                              Backbone.js with CoffeeScript or
                                            „Wow, client side coding no longer
                                            sucks‟ (Len Smith)
Email me at blyttle@liquidhub.com
                                            Building REST API's using ASP.NET Web
                                            API (Devin Rader)
Or tweet to @brianly
                                            Introduction to jQuery Mobile (Aaron
                                            Marisi)

                                            Adding Location Intelligence to your
                                            Windows Phone Apps with Bing Maps
                                            (Nick Landry)

Más contenido relacionado

La actualidad más candente

Android development
Android developmentAndroid development
Android developmentmkpartners
 
iOS App performance - Things to take care
iOS App performance - Things to take careiOS App performance - Things to take care
iOS App performance - Things to take careGurpreet Singh Sachdeva
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)jaxLondonConference
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?Viswanath J
 
Delivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern WebDelivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern WebJoshua Marantz
 
Dell OpenStack Powered Cloud Solution and Case Sharing
Dell OpenStack Powered Cloud Solution and Case SharingDell OpenStack Powered Cloud Solution and Case Sharing
Dell OpenStack Powered Cloud Solution and Case SharingHui Cheng
 
Sg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleySg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleyn_adam_stanley
 
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...Codemotion
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remanijaxconf
 
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...Microsoft
 
Onboarding a Historical Company on the Cloud Journey
Onboarding a Historical Company on the Cloud JourneyOnboarding a Historical Company on the Cloud Journey
Onboarding a Historical Company on the Cloud JourneyMarius Zaharia
 
Rightscale Webinar: Building Blocks for Private and Hybrid Clouds
Rightscale Webinar: Building Blocks for Private and Hybrid CloudsRightscale Webinar: Building Blocks for Private and Hybrid Clouds
Rightscale Webinar: Building Blocks for Private and Hybrid CloudsRightScale
 

La actualidad más candente (12)

Android development
Android developmentAndroid development
Android development
 
iOS App performance - Things to take care
iOS App performance - Things to take careiOS App performance - Things to take care
iOS App performance - Things to take care
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)
 
Android : How Do I Code Thee?
Android : How Do I Code Thee?Android : How Do I Code Thee?
Android : How Do I Code Thee?
 
Delivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern WebDelivering Optimal Images for Phones and Tablets on the Modern Web
Delivering Optimal Images for Phones and Tablets on the Modern Web
 
Dell OpenStack Powered Cloud Solution and Case Sharing
Dell OpenStack Powered Cloud Solution and Case SharingDell OpenStack Powered Cloud Solution and Case Sharing
Dell OpenStack Powered Cloud Solution and Case Sharing
 
Sg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanleySg conference multiplatform_apps_adam_stanley
Sg conference multiplatform_apps_adam_stanley
 
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
 
The economies of scaling software - Abdel Remani
The economies of scaling software - Abdel RemaniThe economies of scaling software - Abdel Remani
The economies of scaling software - Abdel Remani
 
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...
Java dans Windows Azure Cloud Services, big data avec hd insight et les nouve...
 
Onboarding a Historical Company on the Cloud Journey
Onboarding a Historical Company on the Cloud JourneyOnboarding a Historical Company on the Cloud Journey
Onboarding a Historical Company on the Cloud Journey
 
Rightscale Webinar: Building Blocks for Private and Hybrid Clouds
Rightscale Webinar: Building Blocks for Private and Hybrid CloudsRightscale Webinar: Building Blocks for Private and Hybrid Clouds
Rightscale Webinar: Building Blocks for Private and Hybrid Clouds
 

Similar a Building Mobile Web Apps with jQM and Cordova on Azure

State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conferencedmethvin
 
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudWindows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudMichael Collier
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)Jia Mi
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCM First Group
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Adam Mokan
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1drudolph11
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Ryan Cuprak
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive uiPaul van Zyl
 
GWT HJUG Presentation
GWT HJUG PresentationGWT HJUG Presentation
GWT HJUG PresentationDerrick Bowen
 
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-mateevMihail Mateev
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_uDoris Chen
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid DoesKevin McMahon
 

Similar a Building Mobile Web Apps with jQM and Cordova on Azure (20)

State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Software Engineering 2014
Software Engineering 2014Software Engineering 2014
Software Engineering 2014
 
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the CloudWindows Phone 7 and Windows Azure – A Match Made in the Cloud
Windows Phone 7 and Windows Azure – A Match Made in the Cloud
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, Android
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
 
SWTT 140407 session04
SWTT 140407 session04SWTT 140407 session04
SWTT 140407 session04
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
 
2014 Picking a Platform by Anand Kulkarni
2014 Picking a Platform by Anand Kulkarni2014 Picking a Platform by Anand Kulkarni
2014 Picking a Platform by Anand Kulkarni
 
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 
Android quick talk
Android quick talkAndroid quick talk
Android quick talk
 
GWT HJUG Presentation
GWT HJUG PresentationGWT HJUG Presentation
GWT HJUG Presentation
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
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
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid Does
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile...
ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile...ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile...
ADF Mobile: Best Practices for Developing Applications with Oracle ADF Mobile...
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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.pdfsudhanshuwaghmare1
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

Building Mobile Web Apps with jQM and Cordova on Azure

  • 1. Building Mobile Web Apps with jQM and Cordova on Azure Brian Lyttle May 12, 2012
  • 2. Thanks to our sponsors! Complete the session and event evaluations to win an XBOX 360!
  • 3. Today What you should get from this presentation • A broad talk for people who are •How the Azure platform can support mobile interested in mobile apps with HTML5. development. I‟m not providing complete step-by- Cloud •Issues with transitioning apps and data to • step walkthroughs. Azure. • Instead I‟ll be focusing on issues encountered and how they were dealt with. •Framework choices Mobile •An understanding of the issues encountered when building hybrid apps. Shared pain vs. project-specific pain •Integration issues with 3rd party libraries. •Tips for debugging HTML5 mobile apps on Techniques Windows. •Packaging apps for deployment. Pain Focus Time
  • 4. About me • Brian Lyttle – Solution Architect at LiquidHub • E-mail – blyttle@liquidhub.com • Interwebs – @brianly on Twitter – @brianly on Stack Overflow – Blog infrequently at http://brianlyttle.com
  • 5. Background • NextBigThink – LiquidHub‟s annual developer competition • Guilty parties – Rajat Sen (Java Dude) – Steve DiBello (LINQ Maven) – Brian Lyttle (Mobile Dilettante) • Challenge – Build a healthcare demo to support mobile case workers. – Experiment with any technology you think you might need on a future project. • MobiNurse – A “CRM” app for nurses or case workers.
  • 6. Requirements Functional Initial concept with jQTouch • Information forms for each patient. • Listing of assigned patients. • Find a specialist map. • Contact a specialist. • Signature capture. • Claim submission. • User registration. • Password recovery. Technical • Simple password protection. • Minimized data transfer. • Available via a webpage or an app installed on a device. • Support iOS and Android.
  • 7. Architecture What we built and how we put it together User Experience Architecture Components
  • 8. Data Tier Storage options on Azure • SQL Database • Table Storage • Queue • Windows Azure Drive A relational database makes most sense for a CRM app • The exception being BLOB storage for signatures. Tool support • SQL Server Management Studio can connect. • Only a partial set of on-premise functionality is available. • Data Sync is available. Docs at https://www.windowsazure.com/en- us/develop/net/how-to-guides/sql-azure/
  • 9. Web Tier HTTP Service options on Azure • ASP.NET MVC • Nancy Framework • WCF Data Services We wanted to spend more time on the mobile app - so we went with WCF DS • It was really easy to expose our SQL database via the web Tool support • Model designer support in Visual Studio. • URLs are easily hacked for query development. • Data exposed as XML or JSON. Docs at http://msdn.microsoft.com/en-us/data/bb931106
  • 10. Client Tier HTML5 options • Roll our own • jQuery • jQTouch (not part of jQuery) • jQuery Mobile (official!) • Sencha Touch We started out with jQTouch, but reversed that decision • jQuery Mobile proved to be the most consistent and easiest to integrate with 3rd party libs. Tool support • Safari and Chrome share an excellent set of developer tools. • Plugins for Xcode and Eclipse enabled easy offline packaging.
  • 11. Azure Developer Fabric (DevFC.exe) crashes Problem • DevFC.exe crashes when you start to debug a project. Solution • Check if VMware Workstation is installed on your machine. • VMW has a service called “vmware- hostd.exe” which uses port 12001. • DevFC.exe crashes when it fails to bind to this port. • Stop the “VMware Workstation Server” service.
  • 12. Azure Deployment Problem • Azure deployment is slow. • Your mobile app is in a separate location from your web tier. • Cross-domain issues crop up with data access. Solutions • Copy all of the HTML and other assets into your ASP.NET MVC 3 Web Role project. • Deploy it all together for speed and to reduce cost. • Alternatively use JSONP to request data from a different location. • Develop the mobile app inside a browser you control (Cordova). Resources • Windows Azure PowerShell Cmdlets • JSONP and URL-controlled format support for ADO.NET Data Services
  • 13. Getting data in and out of SQL Azure Problems • You can‟t connect with SQL Server Management Studio (SSMS) • When connected to just SQL Azure you have limited functionality available in SSMS. Solutions • Export SQL Scripts for everything. • Migrate using the MS Sync Framework. • Data tier import/export with WAPMMC. • SQL Server Import and Export Wizard. • SQL Azure Migration Wizard (community supported) Resources • Migrating Databases to SQL Azure (SQL Azure Database) • Windows Azure Platform Management Tool (WAPMMC)
  • 14. File I/O on Azure Problem • Your legacy ASP.NET application reads or writes some files on disk. • File access results in exceptions and files are gone after deployment. Solutions • Try using Local Storage initially. • Move to Queues, Blob Storage, Table Storage, SQL Azure if you need: – It to be long lived. – To access the files from other instances. • Broad file write access is only possible from an elevated Startup Task. Resources • Windows Azure Local File Storage - How To Guide and Warnings • Azure FAQ: Can I write to the file system on Windows Azure?
  • 15. Azure Emulator access Problem • You have a mobile device for testing. • A change has been made to the Azure and you want to preview it without deploying to the cloud. • There is a good chance you want to debug some ASP.NET MVC code. Solutions • Avoid debugging from devices and rely on the desktop browsers. • I never found a clean solution to this issue despite asking on StackOverflow. • What I do is: – Open the IIS Manager – Find the site that Azure is using for hosting. – Modify that site so that you can access from another computer, making sure you allow it through any firewalls. – Connect your mobile device to the same network. Resources • Is it possible to access the Azure emulator from another computer on the same network?
  • 16. Know your events Problem • I‟ve used jQuery before but weird things are happening. Solution • Review the documentation for changes to the event handling. • Changes were necessary to support touch, and to support the way that jQM loads pages using AJAX. • Use $(document).bind('pageinit'), not $(document).ready() • New events include tap, taphold, swipe, swipeleft, and swiperight. • Page navigation loads pages without executing the contents of <head>. – Account for situations where a user refreshes the page, or receives a link to a page. Resources • jQuery Mobile Docs: Events
  • 17. Debugging jQM on Windows Problem Debugger Commands • You have some JavaScript code in your mobile debugger; // break into the application that you want to step through or inspect. // debugger Solution // output data console.log(string) • Run the solution in IE with the “F12 Developer Tools”. console.info(string) • Run the solution in Safari or Chrome and open their console.warn(string) developer tools. console.error(string) – With this project we found Safari to be better even though both use WebKit. // inspect JS objects object – In particular, the Geolocation features worked better. Resources // inspect elements • Chrome Developer Tools: Overview // (First select an element) • How to use F12 Developer Tools to Debug your dir($0) Webpages • Android - Debugging Web Apps
  • 18. Event handling duplication with jQM Problem • We ended up with lots of repeated code for event handling. // This gets ugly after a while $('.cases-all').live("pagecreate", function() { // code Solutions }); • Investigate client MVC frameworks. $('.cases-assigned').live("pagecreate", function() { • Popular frameworks: // code – backbone.js }); – JavaScriptMVC $('.case-search').live("pageinit", function() { // code }); Resources • Building Large-Scale jQuery Applications • Using Backbone.js with jQuery Mobile
  • 19. Cache Busting Problem • Mobile browsers like to minimize data usage and are over zealous with caching. Solution • Add some unique junk as a query string parameter during development. • Make sure to remove it when you deploy to production! function cacheBuster() { return '&_cb' + Math.round(new Date().getTime()); }
  • 20. Google Maps integration Problem • You are struggling with getting Google Maps API V3 running with your app. Solution • Check the jQM source tree for updates to the sample. • Make sure the Google scripts are loaded if you navigate from another page. <head> only loads if you refresh the page. Resources • Using Debugging Tools with the Google Maps API
  • 21. Packaging Problem • Your mobile application runs great via the mobile browser, but you want to run it offline too. Solutions • Start by looking into HTML5 Web Storage. This is the foundation. • Apache Cordova (formerly PhoneGap) enables you package an HTML5 application in a native format for a device. – Enables access to native-only features like Contacts and the Camera. – Native to JS bridges are possible through plugins. • PhoneGap Build and Sencha SDK simplify this. • Make sure that you allow requests to the required hosts e.g. *.server.com. • We were able to power our mobile web and Cordova apps with the same HTML. Resources • Cordova: Getting started with iOS • Cordova: Getting started with Android
  • 22. Wrap up Azure Hybrid Apps • Makes a lot of sense if you have an • jQuery Mobile is great for getting in-house ASP.NET application. started in this area as the markup • Possibly overkill if you just need a is simple. backend for prototyping. • Sencha Touch offers better • WCF DS is really simple performance across a smaller set of devices but is mostly JS-driven. Backend as a Service • HTML5 solutions can work well across platforms but iOS tends to • New SaaS category perform a little better (cf. – Parse transitions). – Urban Airship • LinkedIn replaced their iOS app • Additional cost and limited with one written in HTML5, so flexibility. even premium apps are starting to go down this route.
  • 23. Thanks Don‟t forget to complete your evaluations Slides Related talks today From Command Line to Cloud: Will be posted to Developer Tools for Cloud Agility in http://brianlyttle.com shortly. Visual Studio 2012 (Matthew Ammerman) Got questions? Backbone.js with CoffeeScript or „Wow, client side coding no longer sucks‟ (Len Smith) Email me at blyttle@liquidhub.com Building REST API's using ASP.NET Web API (Devin Rader) Or tweet to @brianly Introduction to jQuery Mobile (Aaron Marisi) Adding Location Intelligence to your Windows Phone Apps with Bing Maps (Nick Landry)