SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
AnDevCon III


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
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


         ●   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()
●   Example: Barcode Scanner (ZXing)
                      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
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
         ●   Solution: DIY replacement data structure
    –   No direct interaction between apps
         ●   Solution: API accessed via PendingIntents




                          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
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
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
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



                       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

Mais conteúdo relacionado

Semelhante a App integration: Strategies and Tactics

Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web AppsCommonsWare
 
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
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsCommonsWare
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly BeanCommonsWare
 
Open source Cloud Automation Platform
Open source Cloud Automation PlatformOpen source Cloud Automation Platform
Open source Cloud Automation PlatformKishore Neelamegam
 
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
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeopleSpringPeople
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applicationsFriedger Müffke
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump StartHaim Michael
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop materialReza Yogaswara
 
IBM Connect2014 JMP106
IBM Connect2014 JMP106IBM Connect2014 JMP106
IBM Connect2014 JMP106Thomas Evans
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
Running Code in the Android Stack at ABS 2014
Running Code in the Android Stack at ABS 2014Running Code in the Android Stack at ABS 2014
Running Code in the Android Stack at ABS 2014Opersys inc.
 
How to start your open source project
How to start your open source projectHow to start your open source project
How to start your open source projectEslam Diaa
 
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
 
Apache DeviceMap - ApacheCon Europe 2014
Apache DeviceMap - ApacheCon Europe 2014Apache DeviceMap - ApacheCon Europe 2014
Apache DeviceMap - ApacheCon Europe 2014Werner Keil
 

Semelhante a App integration: Strategies and Tactics (20)

Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web Apps
 
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
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and Tactics
 
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
 
Open source Cloud Automation Platform
Open source Cloud Automation PlatformOpen source Cloud Automation Platform
Open source Cloud Automation Platform
 
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
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeople
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applications
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
Appium solution artizone
Appium solution   artizoneAppium solution   artizone
Appium solution artizone
 
Android Jump Start
Android Jump StartAndroid Jump Start
Android Jump Start
 
Android workshop material
Android workshop materialAndroid workshop material
Android workshop material
 
IBM Connect2014 JMP106
IBM Connect2014 JMP106IBM Connect2014 JMP106
IBM Connect2014 JMP106
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Running Code in the Android Stack at ABS 2014
Running Code in the Android Stack at ABS 2014Running Code in the Android Stack at ABS 2014
Running Code in the Android Stack at ABS 2014
 
How to start your open source project
How to start your open source projectHow to start your open source project
How to start your open source project
 
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
 
Apache DeviceMap - ApacheCon Europe 2014
Apache DeviceMap - ApacheCon Europe 2014Apache DeviceMap - ApacheCon Europe 2014
Apache DeviceMap - ApacheCon Europe 2014
 

Mais de 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
 
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
 
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
 

Mais de CommonsWare (19)

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
 
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
 
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
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
+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...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

App integration: Strategies and Tactics

  • 1. AnDevCon III 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. 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
  • 5. Activities, Implicit Intents ● Making the Selection – No options? Crash! – One option? Automatic start, no intervention – Multiple options? ● Default chooser ● Override chooser (Intent.createChooser()) ● ShareActionProvider ● DIY Copyright © 2012CommonsWare, LLC
  • 6. 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
  • 7. 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() ● Example: Barcode Scanner (ZXing) Copyright © 2012CommonsWare, LLC
  • 8. 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
  • 9. 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
  • 10. UI Integration via RemoteViews ● Limitations – Widgets, methods available in RemoteViews ● Solution: DIY replacement data structure – No direct interaction between apps ● Solution: API accessed via PendingIntents Copyright © 2012CommonsWare, LLC
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. 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
  • 20. 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 Copyright © 2012CommonsWare, LLC
  • 21. 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
  • 22. 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
  • 23. 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