SlideShare a Scribd company logo
1 of 30
Download to read offline
App Integration:
 Strategies and
     Tactics
     Copyright © 2012CommonsWare, LLC
Objective: Add Value
●   Add Value for Users
    –   More functionality without as much
        development effort
●   Add Value for Third Parties
    –   Their apps are more valuable when you help
        drive their adoption
●   Add Value for You
    –   Reciprocity from third parties
                       Copyright © 2012CommonsWare, LLC
Integration Models
●   Peers
    –   Apps with value independent of yours
    –   Hard or soft dependencies
●   Plugins
    –   Apps with no value independent of yours




                      Copyright © 2012CommonsWare, LLC
Difficulty Level:
 One Red Bull
      Copyright © 2012CommonsWare, LLC
Activities, Implicit Intents
●   Make a Generic Request
    –   ACTION_VIEW, ACTION_SEND, etc.
●   User Dictates Terms
    –   What applications are installed that could handle
        it
    –   What application to use for this particular
        request
    –   What to do with that application
                       Copyright © 2012CommonsWare, LLC
Activities, Implicit Intents
●   Making the Selection
    –   No options? Crash!
    –   One option? Automatic start, no intervention
    –   Multiple options?
         ●   Default chooser
         ● Override chooser (Intent.createChooser())
         ● ShareActionProvider


         ●   Apple patent workarounds
         ●   DIY          Copyright © 2012CommonsWare, LLC
Activities, Implicit Intents
●   DIY
    –   PackageManager
        queryIntentActivities() returns list of
        possibilities, given an Intent
    –   You render resulting List somehow
●   Avoiding the No-Options Crash
    –   Same technique: if list empty,
        startActivity() would fail
                      Copyright © 2012CommonsWare, LLC
Activities, Explicit Intents
●   Hard Dependency, Declared in Code
    –   Craft Intent that will only be handled by peer
        application
    –   Use PackageManager
        queryIntentActivities() to confirm it
        exists (or handle the exception)
    –   Use with startActivity() /
        startActivityForResult()

                      Copyright © 2012CommonsWare, LLC
UI Integration via Web
●   No Activity? How About a Web Site?
    –   Easy: launch browser on URL with ACTION_VIEW
    –   More Interesting: Host a WebView
         ●   Pre-fill in forms using
             loadUrl(“javascript:...”)
         ●   Warning #1: May be tough to control
         ●   Warning #2: Dependencies on non-public “APIs”


                          Copyright © 2012CommonsWare, LLC
Difficulty Level:
 Two Red Bulls
      Copyright © 2012CommonsWare, LLC
UI Integration via Web
●   Reverse Integration: Web to App
    –   Key: BROWSABLE category
    –   Option #1: <data> For Your URL
         ●   Option to launch app if app installed, else URL
             directs to Web page to go download the app
    –   Option #2: Something Specific
         ●   Intent.toUri() to generate a URL
         ●   Custom scheme

                           Copyright © 2012CommonsWare, LLC
Integrating Resources
●   createPackageContext()
    –   Returns a Context that will resolve resources
        from some other package
    –   Example Use: theme packs
         ●   APK (possibly paid app) with res0urces representing
             theme
         ●   Detect existence using PackageManager
         ●   Use createPackageContext() to retrieve
             resources and apply to your UI
                          Copyright © 2012CommonsWare, LLC
Integration by ContentProvider
●   All You Need is a Uri
    –   And some idea of what the schema is, so you
        know what to do with it
         ●   Example: plugins implementing a standard schema
             that you require
    –   Getting the Uri
         ●   Well-known resource name
         ●   Bootstrap API (e.g., broadcast, remote service)

                           Copyright © 2012CommonsWare, LLC
Integration by ContentProvider
●   The Permission Proxy
    –   Problem: Your app needs too many permissions
         ●   Example: Calendar integration
    –   Solution
         ●   Wrap OS/third-party ContentProvider in one of
             yours, with same schema
         ●   Put that ContentProvider in plugin, to isolate
             permission
         ●   Check signature to ensure only used by you
                          Copyright © 2012CommonsWare, LLC
Integration by Service
●   Command Pattern
    –   Third Party Supplies Intent Structure
         ●   Action string
         ●   Available extras
    –   Call startService() as Needed
         ●   Directly
         ●   Via PendingIntent (e.g., AlarmManager)


                             Copyright © 2012CommonsWare, LLC
Integration by Service
●   Binding Pattern
    –   Agreed-Upon AIDL
         ●   Peer: first mover
         ●   Plugin: host defines
    –   Third Party Implements AIDL Binder
    –   You Bind and Use



                           Copyright © 2012CommonsWare, LLC
Integration by Broadcast
●   Agreed-Upon Action, Ordered vs. Regular
    –   Peer: first mover
    –   Plugin: host defines
●   One Side Broadcast, Other Side Receives
    –   Manifest-registered receiver
    –   registerReceiver()


                       Copyright © 2012CommonsWare, LLC
Difficulty Level:
Case of Red Bulls
      Copyright © 2012CommonsWare, LLC
UI Integration via RemoteViews
●   Two Apps' UIs Simultaneously
●   RemoteViews Host
    –   Get RemoteViews from third-party
         ●   Broadcast? Remote service?
         ●   Initially, plus changes over time
    –   apply() RemoteViews into your desired
        container

                           Copyright © 2012CommonsWare, LLC
UI Integration via RemoteViews
●   Limitations
    –   Widgets, methods available in RemoteViews
    –   No direct interaction between apps
         ●   Solution: API accessed via PendingIntents




                         Copyright © 2012CommonsWare, LLC
Difficulty Level:
Red Bull Bottling
      Plant
      Copyright © 2012CommonsWare, LLC
UI Integration via Parcelable
●   RemoteViews Got You Down? Roll Your Own!
    –   RemoteViews is a data structure representing
        commands to build a UI
    –   Alternative: DIY RemoteViewsEx
    –   Limitations
         ●   Still loosely coupled for events (PendingIntent,
             Messenger, etc.)
         ●   Effort proportional to the complexity of the UI
             you wish to share
                           Copyright © 2012CommonsWare, LLC
Integrating Code
●   Option #1: createPackageContext()
    –   getClassLoader() will return ClassLoader
        for accessing classes in other APK
         ●   Use CONTEXT_INCLUDE_CODE in
             createPackageContext() call
    –   Use reflection from there (e.g., loadClass())
        to access foreign code


                        Copyright © 2012CommonsWare, LLC
Integrating Code
●   Option #2: DexClassLoader
    –   Given JAR/APK containing dex'd bytecode,
        allows you to load classes just like a regular
        ClassLoader
         ●   Up to you to get the JAR or APK file




                           Copyright © 2012CommonsWare, LLC
Integrating Code
●   WARNING
    –   You might not know where that code came from
         ●   Code injection attacks
    –   Executed code runs with your permissions
         ●   May do things you rather wish they would not
    –   Net: very risky technique



                          Copyright © 2012CommonsWare, LLC
And Now, The
Rest of the Story
      Copyright © 2012CommonsWare, LLC
Discovery Mechanisms
●   Hard-Coded
●   Discovery via Broadcast
    –   Host sends a broadcast periodically (first run,
        package installed, package removed)
    –   Peers/plugins reply with broadcast about
        capabilities
    –   Related: ACTION_PACKAGE_ADDED

                       Copyright © 2012CommonsWare, LLC
Discovery Mechanisms
●   Discovery via Naming Convention
    –   Plugins go in com.myfirm.myapp.plugin.*
    –   Host uses PackageManager to identify
    –   Further Handshaking
         ●   Well-known resource
         ●   Well-known “narrowcast” via setPackage()



                         Copyright © 2012CommonsWare, LLC
More Stuff to Consider
●   Custom Permissions
    –   Users should get a vote on data sharing
●   Integration Library
    –   JAR to ease third-parties working with your host
●   Documentation
    –   Only way anyone will know what to do
         ●   ...and what you would rather they not do

                          Copyright © 2012CommonsWare, LLC
What the Ecosystem Needs
●   Standards
    –   Community-driven implicit Intent actions
●   Scaffolding
    –   Library projects, templates for creating these
        structures
●   End-User Discovery
    –   How do they know what can integrate?

                       Copyright © 2012CommonsWare, LLC

More Related Content

What's hot

Magnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewMagnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewPhilipp Bärfuss
 
Magnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitectureMagnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitecturePhilipp Bärfuss
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch
 
Nadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services session on Google Apps and Google App EngineNadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services session on Google Apps and Google App EngineNadeus Education Services
 
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklum Ukraine
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backboneSC5.io
 
Embedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationEmbedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationBoris Bokowski
 
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Ryan Baxter
 
Flutter vs ReactNative
Flutter vs ReactNativeFlutter vs ReactNative
Flutter vs ReactNativeSumit Sahoo
 

What's hot (9)

Magnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewMagnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - Overview
 
Magnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - ArchitectureMagnolia CMS 5.0 - Architecture
Magnolia CMS 5.0 - Architecture
 
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
soft-shake.ch - Windows Phone 7 „Mango“ – what’s new for Developers?
 
Nadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services session on Google Apps and Google App EngineNadeus Education Services session on Google Apps and Google App Engine
Nadeus Education Services session on Google Apps and Google App Engine
 
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overviewCiklumJavaSat15112011:Andrew Mormysh-GWT features overview
CiklumJavaSat15112011:Andrew Mormysh-GWT features overview
 
2013 04-02-server-side-backbone
2013 04-02-server-side-backbone2013 04-02-server-side-backbone
2013 04-02-server-side-backbone
 
Embedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse applicationEmbedding Web UIs in your Eclipse application
Embedding Web UIs in your Eclipse application
 
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...Lotusphere 2011  Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
 
Flutter vs ReactNative
Flutter vs ReactNativeFlutter vs ReactNative
Flutter vs ReactNative
 

Similar to App Integration (Revised and Updated)

Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web AppsCommonsWare
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsCommonsWare
 
From Android to the Mobile Web
From Android to the Mobile WebFrom Android to the Mobile Web
From Android to the Mobile WebCommonsWare
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipherCommonsWare
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly BeanCommonsWare
 
Android Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewAndroid Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewCommonsWare
 
Open source Cloud Automation Platform
Open source Cloud Automation PlatformOpen source Cloud Automation Platform
Open source Cloud Automation PlatformKishore Neelamegam
 
Using OSGi as a Cloud Platform - Jan Rellermeyer
Using OSGi as a Cloud Platform - Jan RellermeyerUsing OSGi as a Cloud Platform - Jan Rellermeyer
Using OSGi as a Cloud Platform - Jan Rellermeyermfrancis
 
IBM Datapower Gateways - Devops with UrbanCode Deploy
IBM Datapower Gateways - Devops with UrbanCode DeployIBM Datapower Gateways - Devops with UrbanCode Deploy
IBM Datapower Gateways - Devops with UrbanCode DeployJared Putman
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoSerdar Basegmez
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2CommonsWare
 
"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr Khivrych"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr KhivrychFwdays
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeopleSpringPeople
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop materialReza Yogaswara
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applicationsFriedger Müffke
 
JNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerJNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerBryson Tyrrell
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 

Similar to App Integration (Revised and Updated) (20)

Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web Apps
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and Tactics
 
From Android to the Mobile Web
From Android to the Mobile WebFrom Android to the Mobile Web
From Android to the Mobile Web
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipher
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly Bean
 
X Means Y
X Means YX Means Y
X Means Y
 
Android Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewAndroid Development: The 20,000-Foot View
Android Development: The 20,000-Foot View
 
Open source Cloud Automation Platform
Open source Cloud Automation PlatformOpen source Cloud Automation Platform
Open source Cloud Automation Platform
 
Using OSGi as a Cloud Platform - Jan Rellermeyer
Using OSGi as a Cloud Platform - Jan RellermeyerUsing OSGi as a Cloud Platform - Jan Rellermeyer
Using OSGi as a Cloud Platform - Jan Rellermeyer
 
Appium solution artizone
Appium solution   artizoneAppium solution   artizone
Appium solution artizone
 
IBM Datapower Gateways - Devops with UrbanCode Deploy
IBM Datapower Gateways - Devops with UrbanCode DeployIBM Datapower Gateways - Devops with UrbanCode Deploy
IBM Datapower Gateways - Devops with UrbanCode Deploy
 
BP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM DominoBP207 - Meet the Java Application Server You Already Own – IBM Domino
BP207 - Meet the Java Application Server You Already Own – IBM Domino
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2
 
"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr Khivrych"Micro-frontends, web development", Oleksandr Khivrych
"Micro-frontends, web development", Oleksandr Khivrych
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeople
 
Appium
AppiumAppium
Appium
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop material
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applications
 
JNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerJNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution Server
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 

More from CommonsWare

Getting Android Developers for Your Wearables
Getting Android Developers for Your WearablesGetting Android Developers for Your Wearables
Getting Android Developers for Your WearablesCommonsWare
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsCommonsWare
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to BackCommonsWare
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerCommonsWare
 
Mastering the Master Detail Pattern
Mastering the Master Detail PatternMastering the Master Detail Pattern
Mastering the Master Detail PatternCommonsWare
 
Not Quite As Painful Threading
Not Quite As Painful ThreadingNot Quite As Painful Threading
Not Quite As Painful ThreadingCommonsWare
 
Maps V2... And You!
Maps V2... And You!Maps V2... And You!
Maps V2... And You!CommonsWare
 
A Deep Dive Into ViewPager
A Deep Dive Into ViewPagerA Deep Dive Into ViewPager
A Deep Dive Into ViewPagerCommonsWare
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of WearablesCommonsWare
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFCCommonsWare
 
Making Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsMaking Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsCommonsWare
 
AppsWorld Keynote
AppsWorld KeynoteAppsWorld Keynote
AppsWorld KeynoteCommonsWare
 
Android Hardware That's A Little Bit... Odd
Android Hardware That's A Little Bit... OddAndroid Hardware That's A Little Bit... Odd
Android Hardware That's A Little Bit... OddCommonsWare
 
Google TV For Fun
Google TV For FunGoogle TV For Fun
Google TV For FunCommonsWare
 
If I Were Starting Now
If I Were Starting NowIf I Were Starting Now
If I Were Starting NowCommonsWare
 
Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)CommonsWare
 
Tuning Android Applications (Part One)
Tuning Android Applications (Part One)Tuning Android Applications (Part One)
Tuning Android Applications (Part One)CommonsWare
 
Android Library Projects
Android Library ProjectsAndroid Library Projects
Android Library ProjectsCommonsWare
 

More from CommonsWare (18)

Getting Android Developers for Your Wearables
Getting Android Developers for Your WearablesGetting Android Developers for Your Wearables
Getting Android Developers for Your Wearables
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable Apps
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to Back
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManager
 
Mastering the Master Detail Pattern
Mastering the Master Detail PatternMastering the Master Detail Pattern
Mastering the Master Detail Pattern
 
Not Quite As Painful Threading
Not Quite As Painful ThreadingNot Quite As Painful Threading
Not Quite As Painful Threading
 
Maps V2... And You!
Maps V2... And You!Maps V2... And You!
Maps V2... And You!
 
A Deep Dive Into ViewPager
A Deep Dive Into ViewPagerA Deep Dive Into ViewPager
A Deep Dive Into ViewPager
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of Wearables
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFC
 
Making Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsMaking Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business Models
 
AppsWorld Keynote
AppsWorld KeynoteAppsWorld Keynote
AppsWorld Keynote
 
Android Hardware That's A Little Bit... Odd
Android Hardware That's A Little Bit... OddAndroid Hardware That's A Little Bit... Odd
Android Hardware That's A Little Bit... Odd
 
Google TV For Fun
Google TV For FunGoogle TV For Fun
Google TV For Fun
 
If I Were Starting Now
If I Were Starting NowIf I Were Starting Now
If I Were Starting Now
 
Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)Tuning Android Applications (Part Deux)
Tuning Android Applications (Part Deux)
 
Tuning Android Applications (Part One)
Tuning Android Applications (Part One)Tuning Android Applications (Part One)
Tuning Android Applications (Part One)
 
Android Library Projects
Android Library ProjectsAndroid Library Projects
Android Library Projects
 

Recently uploaded

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 

App Integration (Revised and Updated)

  • 1. App Integration: Strategies and Tactics Copyright © 2012CommonsWare, LLC
  • 2. Objective: Add Value ● Add Value for Users – More functionality without as much development effort ● Add Value for Third Parties – Their apps are more valuable when you help drive their adoption ● Add Value for You – Reciprocity from third parties Copyright © 2012CommonsWare, LLC
  • 3. Integration Models ● Peers – Apps with value independent of yours – Hard or soft dependencies ● Plugins – Apps with no value independent of yours Copyright © 2012CommonsWare, LLC
  • 4. Difficulty Level: One Red Bull Copyright © 2012CommonsWare, LLC
  • 5. Activities, Implicit Intents ● Make a Generic Request – ACTION_VIEW, ACTION_SEND, etc. ● User Dictates Terms – What applications are installed that could handle it – What application to use for this particular request – What to do with that application Copyright © 2012CommonsWare, LLC
  • 6. Activities, Implicit Intents ● Making the Selection – No options? Crash! – One option? Automatic start, no intervention – Multiple options? ● Default chooser ● Override chooser (Intent.createChooser()) ● ShareActionProvider ● Apple patent workarounds ● DIY Copyright © 2012CommonsWare, LLC
  • 7. Activities, Implicit Intents ● DIY – PackageManager queryIntentActivities() returns list of possibilities, given an Intent – You render resulting List somehow ● Avoiding the No-Options Crash – Same technique: if list empty, startActivity() would fail Copyright © 2012CommonsWare, LLC
  • 8. Activities, Explicit Intents ● Hard Dependency, Declared in Code – Craft Intent that will only be handled by peer application – Use PackageManager queryIntentActivities() to confirm it exists (or handle the exception) – Use with startActivity() / startActivityForResult() Copyright © 2012CommonsWare, LLC
  • 9. UI Integration via Web ● No Activity? How About a Web Site? – Easy: launch browser on URL with ACTION_VIEW – More Interesting: Host a WebView ● Pre-fill in forms using loadUrl(“javascript:...”) ● Warning #1: May be tough to control ● Warning #2: Dependencies on non-public “APIs” Copyright © 2012CommonsWare, LLC
  • 10. Difficulty Level: Two Red Bulls Copyright © 2012CommonsWare, LLC
  • 11. UI Integration via Web ● Reverse Integration: Web to App – Key: BROWSABLE category – Option #1: <data> For Your URL ● Option to launch app if app installed, else URL directs to Web page to go download the app – Option #2: Something Specific ● Intent.toUri() to generate a URL ● Custom scheme Copyright © 2012CommonsWare, LLC
  • 12. Integrating Resources ● createPackageContext() – Returns a Context that will resolve resources from some other package – Example Use: theme packs ● APK (possibly paid app) with res0urces representing theme ● Detect existence using PackageManager ● Use createPackageContext() to retrieve resources and apply to your UI Copyright © 2012CommonsWare, LLC
  • 13. Integration by ContentProvider ● All You Need is a Uri – And some idea of what the schema is, so you know what to do with it ● Example: plugins implementing a standard schema that you require – Getting the Uri ● Well-known resource name ● Bootstrap API (e.g., broadcast, remote service) Copyright © 2012CommonsWare, LLC
  • 14. Integration by ContentProvider ● The Permission Proxy – Problem: Your app needs too many permissions ● Example: Calendar integration – Solution ● Wrap OS/third-party ContentProvider in one of yours, with same schema ● Put that ContentProvider in plugin, to isolate permission ● Check signature to ensure only used by you Copyright © 2012CommonsWare, LLC
  • 15. Integration by Service ● Command Pattern – Third Party Supplies Intent Structure ● Action string ● Available extras – Call startService() as Needed ● Directly ● Via PendingIntent (e.g., AlarmManager) Copyright © 2012CommonsWare, LLC
  • 16. Integration by Service ● Binding Pattern – Agreed-Upon AIDL ● Peer: first mover ● Plugin: host defines – Third Party Implements AIDL Binder – You Bind and Use Copyright © 2012CommonsWare, LLC
  • 17. Integration by Broadcast ● Agreed-Upon Action, Ordered vs. Regular – Peer: first mover – Plugin: host defines ● One Side Broadcast, Other Side Receives – Manifest-registered receiver – registerReceiver() Copyright © 2012CommonsWare, LLC
  • 18. Difficulty Level: Case of Red Bulls Copyright © 2012CommonsWare, LLC
  • 19. UI Integration via RemoteViews ● Two Apps' UIs Simultaneously ● RemoteViews Host – Get RemoteViews from third-party ● Broadcast? Remote service? ● Initially, plus changes over time – apply() RemoteViews into your desired container Copyright © 2012CommonsWare, LLC
  • 20. UI Integration via RemoteViews ● Limitations – Widgets, methods available in RemoteViews – No direct interaction between apps ● Solution: API accessed via PendingIntents Copyright © 2012CommonsWare, LLC
  • 21. Difficulty Level: Red Bull Bottling Plant Copyright © 2012CommonsWare, LLC
  • 22. UI Integration via Parcelable ● RemoteViews Got You Down? Roll Your Own! – RemoteViews is a data structure representing commands to build a UI – Alternative: DIY RemoteViewsEx – Limitations ● Still loosely coupled for events (PendingIntent, Messenger, etc.) ● Effort proportional to the complexity of the UI you wish to share Copyright © 2012CommonsWare, LLC
  • 23. Integrating Code ● Option #1: createPackageContext() – getClassLoader() will return ClassLoader for accessing classes in other APK ● Use CONTEXT_INCLUDE_CODE in createPackageContext() call – Use reflection from there (e.g., loadClass()) to access foreign code Copyright © 2012CommonsWare, LLC
  • 24. Integrating Code ● Option #2: DexClassLoader – Given JAR/APK containing dex'd bytecode, allows you to load classes just like a regular ClassLoader ● Up to you to get the JAR or APK file Copyright © 2012CommonsWare, LLC
  • 25. Integrating Code ● WARNING – You might not know where that code came from ● Code injection attacks – Executed code runs with your permissions ● May do things you rather wish they would not – Net: very risky technique Copyright © 2012CommonsWare, LLC
  • 26. And Now, The Rest of the Story Copyright © 2012CommonsWare, LLC
  • 27. Discovery Mechanisms ● Hard-Coded ● Discovery via Broadcast – Host sends a broadcast periodically (first run, package installed, package removed) – Peers/plugins reply with broadcast about capabilities – Related: ACTION_PACKAGE_ADDED Copyright © 2012CommonsWare, LLC
  • 28. Discovery Mechanisms ● Discovery via Naming Convention – Plugins go in com.myfirm.myapp.plugin.* – Host uses PackageManager to identify – Further Handshaking ● Well-known resource ● Well-known “narrowcast” via setPackage() Copyright © 2012CommonsWare, LLC
  • 29. More Stuff to Consider ● Custom Permissions – Users should get a vote on data sharing ● Integration Library – JAR to ease third-parties working with your host ● Documentation – Only way anyone will know what to do ● ...and what you would rather they not do Copyright © 2012CommonsWare, LLC
  • 30. What the Ecosystem Needs ● Standards – Community-driven implicit Intent actions ● Scaffolding – Library projects, templates for creating these structures ● End-User Discovery – How do they know what can integrate? Copyright © 2012CommonsWare, LLC