SlideShare uma empresa Scribd logo
1 de 62
Esri Southwest User Conference
September 17-19, 2012 | Denver, Colorado


         Building Mobile Applications with
          the ArcGIS API for JavaScript

                                  Andy Gup
Agenda

 Goal: You’ll get an A to Z mobile web primer

 Why build mobile map apps?

 3 Approaches

 Frameworks

 CSS3 & HTML5

 Hybrid Map apps
Who am I?



   Andy Gup, Esri
   Tech Lead for Web APIs and Android
   Esri Developer Network


   Email: agup@esri.com
   Twitter: @agup
Who are you?
Why mobile?
Demo
X
Mobile usage stats for my website?




Web Server logs


Web analytic tools
Sample web-site stats from esri.com
Your 3 Approaches


                        Web app
     1.                     +
                    Native mobile app



                       Web app
     2.                     +
                    Web mobile app
                     (a.k.a Hybrid)



     3.              Web app only
Many different screen sizes and pixel densities




                            1920x1080
Wait…how do I pan and zoom the map??
Hmmm…how many map layers do I load?




                     VS.




       1 GB RAM                   16 GB RAM
How come my map loads so slooow?




                        VS.




     Mostly connected              Always connected
My survey crews use GPS heavily…




                       VS.




     Limited battery               Unlimited power
arcgis.com




      1440 x 900   480 x 800 hdpi
resources.arcgis.com




      1440 x 900       480 x 800 hdpi
Mobile app – flip view port easily




   Portrait                          Landscape
Desktop app on smartphone
ArcGIS API for JavaScript - Compact




          http://esriurl.com/compactJS




<script type="text/javascript"
    src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1compact">
Library Size vs. Download vs. Parse


         Compact




         Full
Many mobile frameworks, such as…
The challenge
Mobile frameworks help with…



           Views

           Visual Components

           Themes
Views




        Image courtesy Dojo
Views



<div id="mapView" dojoType="dojox.mobile.View“
        style="width:100%;height:100%;">
    <h1 dojoType="dojox.mobile.Heading"
        back="Back" moveTo="mainView">
        5 + 10 minute Drive Times
    </h1>
    <div id="map“ style="width:100%; height:100%;“/>
</div>
Visual Components



<div dojoType="dojox.charting.widget.Chart2D"
     theme="dojox.charting.themes.Claro" id="viewsChart"
     style="width: 550px; height: 550px;">

    <!-- Pie Chart: add the plot -->
    <div class="plot" name="default" type="Pie"
     radius="200" fontColor="#000" labelOffset="-20"></div>

    <!-- pieData is the data source -->
    <div class="series" name="Last Week's Visits"
        array="chartData">
    </div>

</div>
Themes


<!--Legend Dialog-->
<div data-role="dialog" id="legendDialog"
  data-theme="f">
  <div data-role="header">
    <h1>Legend</h1>
  </div>
  <div data-role="content" >
    <div id="legendDiv"></div>
  </div>
</div>
The view port
Setting the mobile view port




<meta name="viewport" content="width=device-width,
   initial-scale=1, maximum-scale=1, user-scalable=no"/>
Setting the mobile view port

                             Minimum view port




<meta name="viewport" content="width=device-width,
   initial-scale=1, maximum-scale=1, user-scalable=no"/>




Zoom level on page load

                               Force map to scale - not the page
No viewport   With viewport
Map touch events


               No Change!



function init() {
        var map = new esri.Map(...);
        dojo.connect(map, "onClick", myClickHandler);
}
Styling via resolution & rotation


          CSS3 Media Queries
CSS3 Media Queries
Target specific devices by screen width

@media screen and (min-device-width:768px) and (max-device-width:1024px) {
/* styles go here */
}



Apply styles by device orientation

@media (orientation: landscape) {
/* styles go here */
}



Target high density screens such as iPhone 4

@media (-webkit-min-device-pixel-ratio: 2) {
/* high resolution device styles go here */
}
Listen for device rotation

var supportsOrientationChange = "onorientationchange" in window,
        orientationEvent =
            supportsOrientationChange ? "orientationchange" : "resize";

       window.addEventListener(orientationEvent,
               dojo.hitch(this,function(){
                    //... TODO
                    this.orientationChanged = orientationChanged;
                }), false
        );
Demo
Putting it all together
Hybrid Web Apps




Android SDK
               +       HTML +
                   Mobile JavaScript
                                       =
Java Project
                     Framework
Hybrid Web Apps
Hybrid Web Apps

                  Direct access to:

                  GPS
                  Camera
                  SD Card
Examples of Hybrid Web Apps
        http://www.phonegap.com/app
Hybrid Web App Platforms
build.phonegap.com
build.phonegap.com
Scan the QR code to install
Hello-World PhoneGap Map
Remote debugging
HTML5

        HTML + CSS3 + JavaScript




                                   HTML5 Logo by W3C
HTML5 APIs
•   Several new APIs
    -   Drag and drop API
    -   FileSystem API(s)
    -   Geolocation API
    -   Web Storage: localStorage/sessionStorage
    -   Web Workers (threaded JavaScript!)
    -   Cross-Origin Resource Sharing (CORS)
    -   Browser History
Web Storage API
•   5 MB limit vs. 4 KB per regular cookie
•   Stores key/value pairs
•   localStorage and sessionStorage

// Put the object into storage
localStorage.setItem(“address”, someAddress);

// Retrieve the object from storage
var userAddress = localStorage.getItem(“address”);


// Save data to a the current session's store
sessionStorage.setItem("username", "John");


// Access some stored data
var userName = sessionStorage.getItem("username"));
Geolocation API
•   Provides user’s approximate location
•   Opt-in only!




navigator.geolocation.getCurrentPosition(
    zoomToLocation, locationError
);

watchId = navigator.geolocation.watchPosition(
    updateLocation, locationError
);
Geolocation API
Understanding browsers




          !=         !=
caniuse.com
Feature detection pattern

useLocalStorage = supports_local_storage();

function supports_local_storage() {
   try {
     return 'localStorage' in window &&
        window['localStorage'] !== null;
   }
   catch( e ){
     return false;
   }
}

function doSomething() {
    if(useLocalStorage == true){
       //write to local storage
    }
    else {
         //degrade gracefully
    }
}
Test on different devices
Andy Gup, Esri
Tech Lead for Web APIs and Android
Esri Developer Network


agup@esri.com
http://blog.andygup.net
@agup
3 Approaches to Mobile - An A to Z Primer.

Mais conteúdo relacionado

Semelhante a 3 Approaches to Mobile - An A to Z Primer.

Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Esri Nederland
 
Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Webmikeleeme
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers dssprakash
 
Devon 2011-f-1 반응형 웹 디자인
Devon 2011-f-1  반응형 웹 디자인Devon 2011-f-1  반응형 웹 디자인
Devon 2011-f-1 반응형 웹 디자인Daum DNA
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Patrick Lauke
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development LandscapeAmbert Ho
 
Building responsive web mobile mapping applications
Building responsive web mobile mapping applicationsBuilding responsive web mobile mapping applications
Building responsive web mobile mapping applicationsAllan Laframboise
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - MozillaRobert Nyman
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and moreYan Shi
 
Web app and more
Web app and moreWeb app and more
Web app and morefaming su
 
Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5Ron Reiter
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发Zhang Xiaoxue
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Todaydavyjones
 
Bruce lawson-over-the-air
Bruce lawson-over-the-airBruce lawson-over-the-air
Bruce lawson-over-the-airbrucelawson
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Adam Lu
 
Web enabling your survey business ppt version
Web enabling your survey business ppt versionWeb enabling your survey business ppt version
Web enabling your survey business ppt versionrudy_stricklan
 
Intro to PhoneGap and PhoneGap Build
Intro to PhoneGap and PhoneGap BuildIntro to PhoneGap and PhoneGap Build
Intro to PhoneGap and PhoneGap BuildChris Griffith
 

Semelhante a 3 Approaches to Mobile - An A to Z Primer. (20)

Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
Building mobile apps with the ArcGIS api for Javascript, Esri, Andy Gup and A...
 
Gup web mobilegis
Gup web mobilegisGup web mobilegis
Gup web mobilegis
 
Pinkoi Mobile Web
Pinkoi Mobile WebPinkoi Mobile Web
Pinkoi Mobile Web
 
Location Based Services Without the Cocoa
Location Based Services Without the CocoaLocation Based Services Without the Cocoa
Location Based Services Without the Cocoa
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 
Devon 2011-f-1 반응형 웹 디자인
Devon 2011-f-1  반응형 웹 디자인Devon 2011-f-1  반응형 웹 디자인
Devon 2011-f-1 반응형 웹 디자인
 
Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010Making your site mobile-friendly - DevCSI Reading 21.07.2010
Making your site mobile-friendly - DevCSI Reading 21.07.2010
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development Landscape
 
Best Practices for Mobile Web Design
Best Practices for Mobile Web DesignBest Practices for Mobile Web Design
Best Practices for Mobile Web Design
 
Building responsive web mobile mapping applications
Building responsive web mobile mapping applicationsBuilding responsive web mobile mapping applications
Building responsive web mobile mapping applications
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5
 
移动端Web app开发
移动端Web app开发移动端Web app开发
移动端Web app开发
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Bruce lawson-over-the-air
Bruce lawson-over-the-airBruce lawson-over-the-air
Bruce lawson-over-the-air
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)
 
Web enabling your survey business ppt version
Web enabling your survey business ppt versionWeb enabling your survey business ppt version
Web enabling your survey business ppt version
 
Intro to PhoneGap and PhoneGap Build
Intro to PhoneGap and PhoneGap BuildIntro to PhoneGap and PhoneGap Build
Intro to PhoneGap and PhoneGap Build
 

Último

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 WorkerThousandEyes
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

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
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

3 Approaches to Mobile - An A to Z Primer.

  • 1. Esri Southwest User Conference September 17-19, 2012 | Denver, Colorado Building Mobile Applications with the ArcGIS API for JavaScript Andy Gup
  • 2. Agenda Goal: You’ll get an A to Z mobile web primer Why build mobile map apps? 3 Approaches Frameworks CSS3 & HTML5 Hybrid Map apps
  • 3. Who am I? Andy Gup, Esri Tech Lead for Web APIs and Android Esri Developer Network Email: agup@esri.com Twitter: @agup
  • 7.
  • 8. X
  • 9.
  • 10. Mobile usage stats for my website? Web Server logs Web analytic tools
  • 11. Sample web-site stats from esri.com
  • 12. Your 3 Approaches Web app 1. + Native mobile app Web app 2. + Web mobile app (a.k.a Hybrid) 3. Web app only
  • 13. Many different screen sizes and pixel densities 1920x1080
  • 14. Wait…how do I pan and zoom the map??
  • 15. Hmmm…how many map layers do I load? VS. 1 GB RAM 16 GB RAM
  • 16. How come my map loads so slooow? VS. Mostly connected Always connected
  • 17.
  • 18. My survey crews use GPS heavily… VS. Limited battery Unlimited power
  • 19. arcgis.com 1440 x 900 480 x 800 hdpi
  • 20. resources.arcgis.com 1440 x 900 480 x 800 hdpi
  • 21. Mobile app – flip view port easily Portrait Landscape
  • 22. Desktop app on smartphone
  • 23. ArcGIS API for JavaScript - Compact http://esriurl.com/compactJS <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1compact">
  • 24. Library Size vs. Download vs. Parse Compact Full
  • 25. Many mobile frameworks, such as… The challenge
  • 26. Mobile frameworks help with… Views Visual Components Themes
  • 27. Views Image courtesy Dojo
  • 28. Views <div id="mapView" dojoType="dojox.mobile.View“ style="width:100%;height:100%;"> <h1 dojoType="dojox.mobile.Heading" back="Back" moveTo="mainView"> 5 + 10 minute Drive Times </h1> <div id="map“ style="width:100%; height:100%;“/> </div>
  • 29. Visual Components <div dojoType="dojox.charting.widget.Chart2D" theme="dojox.charting.themes.Claro" id="viewsChart" style="width: 550px; height: 550px;"> <!-- Pie Chart: add the plot --> <div class="plot" name="default" type="Pie" radius="200" fontColor="#000" labelOffset="-20"></div> <!-- pieData is the data source --> <div class="series" name="Last Week's Visits" array="chartData"> </div> </div>
  • 30. Themes <!--Legend Dialog--> <div data-role="dialog" id="legendDialog" data-theme="f"> <div data-role="header"> <h1>Legend</h1> </div> <div data-role="content" > <div id="legendDiv"></div> </div> </div>
  • 32. Setting the mobile view port <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
  • 33. Setting the mobile view port Minimum view port <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/> Zoom level on page load Force map to scale - not the page
  • 34. No viewport With viewport
  • 35. Map touch events No Change! function init() { var map = new esri.Map(...); dojo.connect(map, "onClick", myClickHandler); }
  • 36. Styling via resolution & rotation CSS3 Media Queries
  • 37. CSS3 Media Queries Target specific devices by screen width @media screen and (min-device-width:768px) and (max-device-width:1024px) { /* styles go here */ } Apply styles by device orientation @media (orientation: landscape) { /* styles go here */ } Target high density screens such as iPhone 4 @media (-webkit-min-device-pixel-ratio: 2) { /* high resolution device styles go here */ }
  • 38. Listen for device rotation var supportsOrientationChange = "onorientationchange" in window, orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"; window.addEventListener(orientationEvent, dojo.hitch(this,function(){ //... TODO this.orientationChanged = orientationChanged; }), false );
  • 40. Hybrid Web Apps Android SDK + HTML + Mobile JavaScript = Java Project Framework
  • 42. Hybrid Web Apps Direct access to: GPS Camera SD Card
  • 43. Examples of Hybrid Web Apps http://www.phonegap.com/app
  • 44. Hybrid Web App Platforms
  • 47. Scan the QR code to install
  • 49.
  • 51. HTML5 HTML + CSS3 + JavaScript HTML5 Logo by W3C
  • 52. HTML5 APIs • Several new APIs - Drag and drop API - FileSystem API(s) - Geolocation API - Web Storage: localStorage/sessionStorage - Web Workers (threaded JavaScript!) - Cross-Origin Resource Sharing (CORS) - Browser History
  • 53. Web Storage API • 5 MB limit vs. 4 KB per regular cookie • Stores key/value pairs • localStorage and sessionStorage // Put the object into storage localStorage.setItem(“address”, someAddress); // Retrieve the object from storage var userAddress = localStorage.getItem(“address”); // Save data to a the current session's store sessionStorage.setItem("username", "John"); // Access some stored data var userName = sessionStorage.getItem("username"));
  • 54. Geolocation API • Provides user’s approximate location • Opt-in only! navigator.geolocation.getCurrentPosition( zoomToLocation, locationError ); watchId = navigator.geolocation.watchPosition( updateLocation, locationError );
  • 58. Feature detection pattern useLocalStorage = supports_local_storage(); function supports_local_storage() { try { return 'localStorage' in window && window['localStorage'] !== null; } catch( e ){ return false; } } function doSomething() { if(useLocalStorage == true){ //write to local storage } else { //degrade gracefully } }
  • 59. Test on different devices
  • 60.
  • 61. Andy Gup, Esri Tech Lead for Web APIs and Android Esri Developer Network agup@esri.com http://blog.andygup.net @agup

Notas do Editor

  1. Demographics app
  2. 835 million smartphone users in 2011
  3. http://www.esri.com/site/pdfs/visitorprofile_q3_2011.pdf
  4. http://mobile.businessweek.com/articles/2012-09-13/the-4g-era-arrives-how-much-will-you-pay
  5. Arcgis.com
  6. Arcgis.com
  7. http://esriurl.com/compactJS
  8. http://dojotoolkit.org/reference-guide/1.8/dojox/mobile.htmlhttp://docs.sencha.com/touch/2-0/#!/api
  9. jQuery
  10. Locks entire window. Focuses pinch zoom on components (e.g. map).Pinch zoom not available on Android 3+ until ArcGIS API for JavaScript v3.2
  11. https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag
  12. http://edn1.esri.com/jsdevstarter/device_sim/index.html
  13. You can do the same thing with iOS
  14. http://phonegap.com/2012/03/19/phonegap-cordova-and-what%E2%80%99s-in-a-name/
  15. http://phonegap.com/2012/03/19/phonegap-cordova-and-what%E2%80%99s-in-a-name/
  16. http://venturebeat.com/2012/05/02/linkedin-ipad-app-engineering/#s:1-linkedin-ipadhttp://www.mobilemarketer.com/cms/news/software-technology/13786.html
  17. Modernizr
  18. Be careful when reusing desktop content on the mobile web