SlideShare a Scribd company logo
Integrating
Android Apps
and Web Apps
    Copyright © 2013 CommonsWare, LLC
Objective: Add Value
●   App complements site, does not replace it
    –   Different roles, different scenarios
●   Support multiple screens
    –   Browser on desktop interacting with app on
        device
●   Single source
    –   App and site leverage same Web service back
        end
                       Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Objective
    –   User clicks on link in Web site from mobile
        browser
    –   App pops up in response to that click
●   Examples
    –   Wikipedia
    –   Barcode scanning

                       Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #1: Regular URL
    –   Site has link to:
        http://www.yourdomain.com/something
    –   What App Has
         ●   Activity to be displayed when that link is clicked
         ●   <intent-filter> advertising supporting VIEW action,
             BROWSABLE category, and that URL



                           Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #1: Regular URL
    –   What User Sees
         ●   If app not installed: whatever is at that URL
         ●   If app is installed: chooser to use browser or app to
             process the request (unless default already chosen)
    –   Passing Data
         ●   Additional path segments (with pathPrefix)
         ●   Query parameters

                           Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #1: Regular URL
    –   Limitation: Chooser appears
         ●   User can make your app be the default for this
             particular request, but still sees chooser the first time
         ●   No way to avoid allowing a Web browser to handle
             an HTTP link




                           Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #2: Custom Scheme
    –   Site has link to: yourscheme://something
    –   What App Has
         ●   Activity to be displayed when that link is clicked
         ●   <intent-filter> advertising supporting VIEW action,
             BROWSABLE category, and that URL complete with
             custom scheme



                           Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #2: Custom Scheme
    –   Pros
         ●   No chooser!
         ●   Alignment with other operating systems
    –   Cons
         ●   Link is useless without app
         ●   Possible scheme collision


                           Copyright © 2013 CommonsWare, LLC
Launching App from Web
●   Strategy #3: Custom MIME Type
    –   Site serves up content under distinct vendor
        MIME type, that your app handles
    –   Cons
         ●   Effects not immediate: download first, tap on
             notification, then get into your app
         ●   Possible MIME type collisions
●   Overall Con: Assumes Browsing from the
    Device
                          Copyright © 2013 CommonsWare, LLC
Launching App from Desktop Web
●   Strategy #1: QR Codes
    –   App displays QR code, user scans
    –   Requires QR code-scanning app
         ●   Barcode Scanner
         ●   Google Goggles
         ●   Etc.




                         Copyright © 2013 CommonsWare, LLC
Launching App from Desktop Web
●   Strategy #2: Push with GCM
    –   Google Cloud Messaging
    –   Push messages from your server to the device
         ●   In response to actions within your Web app
         ●   In response to other conditions (e.g., reminders)
    –   Free!
    –   Requires Android 2.2+, routing data through
        Google servers
                           Copyright © 2013 CommonsWare, LLC
Launching App from Desktop Web
●   Strategy #2: Push with GCM
    –   Client Side Steps
         ●   Get an API key
         ●   Add GCM JAR to your libs/ directory
         ●   Add permissions
         ●   Register a GCM-supplied BroadcastReceiver
         ●   Implement an IntentService that handles events
         ●   Register the app when run
         ●   Send registration ID to your server
                           Copyright © 2013 CommonsWare, LLC
Launching App from Desktop Web
●   Strategy #2: Push with GCM
    –   Server Side Steps
         ●   Find GCM server library
         ●   Create JSON of payload and other options
         ●   Send notification with payload and registration IDs




                          Copyright © 2013 CommonsWare, LLC
Getting to Web from App
●   Option #1: ACTION_VIEW
    –   Create an ACTION_VIEW Intent, with the URL
        you wish to visit
    –   Pass that to startActivity()
    –   Result: default/chosen browser launched




                      Copyright © 2013 CommonsWare, LLC
Getting to Web from App
●   Option #2: WebView
    –   Embed WebView widget in layout, used by
        activity or fragment
         ●   WebViewFragment available for API Level 11
             fragments
    –   Configure WebView
         ●   e.g., JavaScript disabled by default
    –   Call loadUrl() with your URL
    –   Result: your Web site in your app
                           Copyright © 2013 CommonsWare, LLC
Fancier Stuff
●   Common Web Service
    –   App plus “single page application” or equivalent
    –   Works best with REST-style APIs (vs. SOAP, XML-
        RPC, etc.)
●   OAuth
    –   Common authentication infrastructure for app,
        Web site
    –   App side tends to be a bit clunky
                       Copyright © 2013 CommonsWare, LLC
Fancier Stuff
●   Common Implementation
    –   Use same Web technologies on device as on
        desktop
    –   HTML5 app, PhoneGap, etc.
●   “Throwing” Between Screens
    –   Capture current session state, package up in way
        that other environment can continue

                      Copyright © 2013 CommonsWare, LLC
Speaker Contact
    Information




       SlideShare


       Copyright © 2013 CommonsWare, LLC

More Related Content

PDF
Progressive web apps
PDF
Progressive Web Apps
PPTX
Progressive web application
PPTX
Pwa.pptx
PPT
Progressive Web Apps - Up & Running
PPTX
Progressive Web App
PDF
Baobab WebSuite overview - Publisher's Toolbox
PPTX
PWA demystified
Progressive web apps
Progressive Web Apps
Progressive web application
Pwa.pptx
Progressive Web Apps - Up & Running
Progressive Web App
Baobab WebSuite overview - Publisher's Toolbox
PWA demystified

What's hot (20)

PPTX
Progressive web app
PPTX
Progressive Web Apps
PDF
Connfa! Progressive web app
PDF
Introduction to Progressive web app (PWA)
PPTX
Progressive Web-App (PWA)
PPTX
PWA ( Progressive Web Apps ) - Sai Kiran Kasireddy
PPTX
Pwa demystified
PDF
Why your website should be a progressive web application (PWA)
PPTX
Progressive Web Apps: Opera's perspective
PDF
Cinebody 2.2 Update
ODP
Joomla page end social share
PPTX
PWA - Progressive Web App
PDF
Getting Started with Progressive Web Apps
PDF
Progressive Web Apps
PPTX
Progressive Web Apps 101
PPT
Platform Play Web Social And Mobile For P Camp09
PDF
Progressive Web Apps / GDG DevFest - Season 2016
PDF
Introducing Mobile Cross Promotion Framework
PDF
Progressive Web Apps
PDF
Next Generation Mobile Web - PWA (Progressive Web App)
Progressive web app
Progressive Web Apps
Connfa! Progressive web app
Introduction to Progressive web app (PWA)
Progressive Web-App (PWA)
PWA ( Progressive Web Apps ) - Sai Kiran Kasireddy
Pwa demystified
Why your website should be a progressive web application (PWA)
Progressive Web Apps: Opera's perspective
Cinebody 2.2 Update
Joomla page end social share
PWA - Progressive Web App
Getting Started with Progressive Web Apps
Progressive Web Apps
Progressive Web Apps 101
Platform Play Web Social And Mobile For P Camp09
Progressive Web Apps / GDG DevFest - Season 2016
Introducing Mobile Cross Promotion Framework
Progressive Web Apps
Next Generation Mobile Web - PWA (Progressive Web App)
Ad

Similar to Integrate Android Apps and Web Apps (20)

PDF
Ibrussels For Stedenlink
PDF
Uniway seminar ecommerce - 2011 10 04 - v2
PDF
Mobile web vs. native apps: It's not about technology, it's about psychology
PDF
Future of Mobile Web Application and Web App Store
PPTX
Consider Starting Small
PDF
Google DevFest 2012 Presentation
PDF
Developing TouchActive with GAE and GWT - Google DevFest Barcelona 2012
PDF
Google Dev Fest Presentation
PDF
Mobile Apps 2012 conference: From concept to release
PPTX
Mobile development services
PDF
Technological Strategies & Monetization
PDF
Native vs HTML
KEY
Saying no to native apps - UX Masterclass Copenhagen
PDF
Gdd Keynote V China
PDF
Considerations for Your Mobile Library
PDF
Intro To Mobile Apps
PDF
Dnx Mobile Marketing Golden Rules
KEY
Library Mobile Web Design: Tips, Tricks and Resources
PDF
Mobile for B2B: Native or Web?
KEY
Mobile Apps and the Enterprise
Ibrussels For Stedenlink
Uniway seminar ecommerce - 2011 10 04 - v2
Mobile web vs. native apps: It's not about technology, it's about psychology
Future of Mobile Web Application and Web App Store
Consider Starting Small
Google DevFest 2012 Presentation
Developing TouchActive with GAE and GWT - Google DevFest Barcelona 2012
Google Dev Fest Presentation
Mobile Apps 2012 conference: From concept to release
Mobile development services
Technological Strategies & Monetization
Native vs HTML
Saying no to native apps - UX Masterclass Copenhagen
Gdd Keynote V China
Considerations for Your Mobile Library
Intro To Mobile Apps
Dnx Mobile Marketing Golden Rules
Library Mobile Web Design: Tips, Tricks and Resources
Mobile for B2B: Native or Web?
Mobile Apps and the Enterprise
Ad

More from CommonsWare (20)

PDF
Gradle and Your Android Wearable Projects
PDF
Getting Android Developers for Your Wearables
PDF
When Microwatts Are Precious: Battery Tips for Wearable Apps
PDF
The Action Bar: Front to Back
PDF
Android Security: Defending Your Users
PDF
Secondary Screen Support Using DisplayManager
PDF
Mastering the Master Detail Pattern
PDF
Not Quite As Painful Threading
PDF
Android Development: The 20,000-Foot View
PDF
Maps V2... And You!
PDF
A Deep Dive Into ViewPager
PDF
Second-Screen Support in Android 4.2
PDF
From Android to the Mobile Web
PDF
X Means Y
PDF
The Wonderful World of Wearables
PDF
Securing User Data with SQLCipher
PDF
Beaming Data to Devices with NFC
PDF
What's New in Jelly Bean
PDF
Making Money at Mobile: 60 Business Models
PDF
AppsWorld Keynote
Gradle and Your Android Wearable Projects
Getting Android Developers for Your Wearables
When Microwatts Are Precious: Battery Tips for Wearable Apps
The Action Bar: Front to Back
Android Security: Defending Your Users
Secondary Screen Support Using DisplayManager
Mastering the Master Detail Pattern
Not Quite As Painful Threading
Android Development: The 20,000-Foot View
Maps V2... And You!
A Deep Dive Into ViewPager
Second-Screen Support in Android 4.2
From Android to the Mobile Web
X Means Y
The Wonderful World of Wearables
Securing User Data with SQLCipher
Beaming Data to Devices with NFC
What's New in Jelly Bean
Making Money at Mobile: 60 Business Models
AppsWorld Keynote

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
A Presentation on Artificial Intelligence
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Integrate Android Apps and Web Apps

  • 1. Integrating Android Apps and Web Apps Copyright © 2013 CommonsWare, LLC
  • 2. Objective: Add Value ● App complements site, does not replace it – Different roles, different scenarios ● Support multiple screens – Browser on desktop interacting with app on device ● Single source – App and site leverage same Web service back end Copyright © 2013 CommonsWare, LLC
  • 3. Launching App from Web ● Objective – User clicks on link in Web site from mobile browser – App pops up in response to that click ● Examples – Wikipedia – Barcode scanning Copyright © 2013 CommonsWare, LLC
  • 4. Launching App from Web ● Strategy #1: Regular URL – Site has link to: http://www.yourdomain.com/something – What App Has ● Activity to be displayed when that link is clicked ● <intent-filter> advertising supporting VIEW action, BROWSABLE category, and that URL Copyright © 2013 CommonsWare, LLC
  • 5. Launching App from Web ● Strategy #1: Regular URL – What User Sees ● If app not installed: whatever is at that URL ● If app is installed: chooser to use browser or app to process the request (unless default already chosen) – Passing Data ● Additional path segments (with pathPrefix) ● Query parameters Copyright © 2013 CommonsWare, LLC
  • 6. Launching App from Web ● Strategy #1: Regular URL – Limitation: Chooser appears ● User can make your app be the default for this particular request, but still sees chooser the first time ● No way to avoid allowing a Web browser to handle an HTTP link Copyright © 2013 CommonsWare, LLC
  • 7. Launching App from Web ● Strategy #2: Custom Scheme – Site has link to: yourscheme://something – What App Has ● Activity to be displayed when that link is clicked ● <intent-filter> advertising supporting VIEW action, BROWSABLE category, and that URL complete with custom scheme Copyright © 2013 CommonsWare, LLC
  • 8. Launching App from Web ● Strategy #2: Custom Scheme – Pros ● No chooser! ● Alignment with other operating systems – Cons ● Link is useless without app ● Possible scheme collision Copyright © 2013 CommonsWare, LLC
  • 9. Launching App from Web ● Strategy #3: Custom MIME Type – Site serves up content under distinct vendor MIME type, that your app handles – Cons ● Effects not immediate: download first, tap on notification, then get into your app ● Possible MIME type collisions ● Overall Con: Assumes Browsing from the Device Copyright © 2013 CommonsWare, LLC
  • 10. Launching App from Desktop Web ● Strategy #1: QR Codes – App displays QR code, user scans – Requires QR code-scanning app ● Barcode Scanner ● Google Goggles ● Etc. Copyright © 2013 CommonsWare, LLC
  • 11. Launching App from Desktop Web ● Strategy #2: Push with GCM – Google Cloud Messaging – Push messages from your server to the device ● In response to actions within your Web app ● In response to other conditions (e.g., reminders) – Free! – Requires Android 2.2+, routing data through Google servers Copyright © 2013 CommonsWare, LLC
  • 12. Launching App from Desktop Web ● Strategy #2: Push with GCM – Client Side Steps ● Get an API key ● Add GCM JAR to your libs/ directory ● Add permissions ● Register a GCM-supplied BroadcastReceiver ● Implement an IntentService that handles events ● Register the app when run ● Send registration ID to your server Copyright © 2013 CommonsWare, LLC
  • 13. Launching App from Desktop Web ● Strategy #2: Push with GCM – Server Side Steps ● Find GCM server library ● Create JSON of payload and other options ● Send notification with payload and registration IDs Copyright © 2013 CommonsWare, LLC
  • 14. Getting to Web from App ● Option #1: ACTION_VIEW – Create an ACTION_VIEW Intent, with the URL you wish to visit – Pass that to startActivity() – Result: default/chosen browser launched Copyright © 2013 CommonsWare, LLC
  • 15. Getting to Web from App ● Option #2: WebView – Embed WebView widget in layout, used by activity or fragment ● WebViewFragment available for API Level 11 fragments – Configure WebView ● e.g., JavaScript disabled by default – Call loadUrl() with your URL – Result: your Web site in your app Copyright © 2013 CommonsWare, LLC
  • 16. Fancier Stuff ● Common Web Service – App plus “single page application” or equivalent – Works best with REST-style APIs (vs. SOAP, XML- RPC, etc.) ● OAuth – Common authentication infrastructure for app, Web site – App side tends to be a bit clunky Copyright © 2013 CommonsWare, LLC
  • 17. Fancier Stuff ● Common Implementation – Use same Web technologies on device as on desktop – HTML5 app, PhoneGap, etc. ● “Throwing” Between Screens – Capture current session state, package up in way that other environment can continue Copyright © 2013 CommonsWare, LLC
  • 18. Speaker Contact Information SlideShare Copyright © 2013 CommonsWare, LLC