SlideShare a Scribd company logo
   
Droidcon UK 2010
Android Reuse Models
   
Why Reuse?
● #1Way to Improve Overall App Quality
– Establish solid patterns once, reuse often
● FasterTime to Market for Developers
● Sign of Solid Ecosystem and Community
   
Three Reuse Models
● The APK
● The JAR
● The Android Library Project
   
APK
● Expose API
– Content Provider
– AIDL
– Intents (broadcasts, IntentService, etc.)
● Benefit
– Only form of “reuse” at the app level =
integration
   
APK
● Challenges
– What if it is not installed?
● Semi-solution: bootstrap JAR with clean local API
plus APK detection and installation assist
● What happens if user uninstalls?
– Coarse-grained integration
● No frameworks, no widgets, etc.
   
JAR
● Expose Class Library
– No different than traditional JARs
– Developers integrate via libs/ and build path
● Benefits
– Classic, battle-tested technique
– Pretty easy to package up
● Eclipse or jar command
   
JAR
● Challenges
– Cannot include Android resources in JARs
● Would need to distribute separately, rely on
developer to unpack into project
– Resource IDs determined by hosting project
● Requires reflection or pass-the-ID-via-API
● Might run into namespace collisions
   
Library Project
● Recent Addition to Android DevTools
● Purposes
– Enable free/paid apps from (mostly) single code
base
– Support reuse...sorta
   
Library Project
● Basic Steps
– Create a library project (Eclipse or android
create lib-project)
– Create a demo project and/or test project
– Put reusable code, resources in library project
– Use demo/test project(s) to confirm it works
– Distribute it...somehow...
   
Library Project
● Benefits
– Can distribute resources
– Apparently Google's model going forward (LVL)
● Challenges
– Cross-library resource collisions
– Binary-only (vs. distributing source code)
– How to distribute it
   
Library Projects
● Avoiding Resource Name Collisions
– Prefix your resource names with something
distinctive (yet, preferably, not crazy long)
● Filenames for standard resources
● android:name attributes for “values” resources
– JARs: Use reflection and caching for resource ID
lookups
● E.g., ParcelHelper from CWAC-Parcel
   
Library Projects
● Binary-Only Library Projects
– Your library project is normal, with source code
– Packaging
● Create JAR from bin/classes/
● Put JAR in ZIP file's libs/
● Put rest of non-source library project stuff in ZIP in
proper directories
● Result: ZIP'd library project sans source
   
Library Projects
● Distribution Options
– ZIP/TAR
● Necessary for the binary-only option
● Could also be used for regular project as well
– Version Control Repository
– Maven
   
WhatTo Distribute
● License
● Documentation
● Demo Project
– Extends documentation with running code
● Clear Information
– Support channels
– How to get upgrades
   
A HomeTo Call Our Own
● What's Needed: Components Catalog
– Entries per component with consistent
metadata, links to distribution artifacts
– Good search interface
– Web 2.0/social hooks (tagging, rating, sharing,
tweeting, etc.)
– Ecosystem hooks (proprietary components?)
– Goal: “go-to” place for reuse
   
WhereTo Learn More
● Android Developer Documentation
– Android library projects, with or without Eclipse
● Android Parcel Project
– Tips, tools, conventions for reuse
– andparcel.com
● Standard Java Knowledge Bases
– JARs, Maven, Ant, etc.
   
Recap
● ReuseWill Help All Long-Term
– Higher-quality apps help users and the overall
ecosystem
– Faster-written apps help developers
● CanYou Contribute?
– Write (sell?) components
– Component catalog site

More Related Content

What's hot

Creating your own Android library and documenting it with Javadocs
Creating your own Android library and documenting it with JavadocsCreating your own Android library and documenting it with Javadocs
Creating your own Android library and documenting it with Javadocs
Arnav Gupta
 

What's hot (18)

From Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEFrom Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDE
 
10 Usability Heuristics - IntelliJ IDEA
10 Usability Heuristics - IntelliJ IDEA10 Usability Heuristics - IntelliJ IDEA
10 Usability Heuristics - IntelliJ IDEA
 
Why companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose FlutterWhy companies like Google, Alibaba and UOL choose Flutter
Why companies like Google, Alibaba and UOL choose Flutter
 
Kotlin multiplataforma
Kotlin multiplataformaKotlin multiplataforma
Kotlin multiplataforma
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to Flutter
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
IntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and PerformanceIntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and Performance
 
Creating your own Android library and documenting it with Javadocs
Creating your own Android library and documenting it with JavadocsCreating your own Android library and documenting it with Javadocs
Creating your own Android library and documenting it with Javadocs
 
Lezione 03 Introduzione a react
Lezione 03   Introduzione a reactLezione 03   Introduzione a react
Lezione 03 Introduzione a react
 
Flutter introduction
Flutter introductionFlutter introduction
Flutter introduction
 
Flutter bus 2018
Flutter bus 2018Flutter bus 2018
Flutter bus 2018
 
Cross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React NativeCross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React Native
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
IntroToAndroid
IntroToAndroidIntroToAndroid
IntroToAndroid
 
Top Programming Languages & Frameworks For App Development
Top Programming Languages & Frameworks For App DevelopmentTop Programming Languages & Frameworks For App Development
Top Programming Languages & Frameworks For App Development
 
Flutter 1
Flutter 1Flutter 1
Flutter 1
 
PDE builds or Maven
PDE builds or MavenPDE builds or Maven
PDE builds or Maven
 
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
 

Similar to Android: Reuse Models

Drupal and the semantic web - SemTechBiz 2012
Drupal and the semantic web - SemTechBiz 2012Drupal and the semantic web - SemTechBiz 2012
Drupal and the semantic web - SemTechBiz 2012
scorlosquet
 

Similar to Android: Reuse Models (20)

Drupal as a Semantic Web platform - ISWC 2012
Drupal as a Semantic Web platform - ISWC 2012Drupal as a Semantic Web platform - ISWC 2012
Drupal as a Semantic Web platform - ISWC 2012
 
Android Library Projects
Android Library ProjectsAndroid Library Projects
Android Library Projects
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Libraries
 
Apache Cordova
Apache CordovaApache Cordova
Apache Cordova
 
Isomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactIsomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and React
 
Drupal and the semantic web - SemTechBiz 2012
Drupal and the semantic web - SemTechBiz 2012Drupal and the semantic web - SemTechBiz 2012
Drupal and the semantic web - SemTechBiz 2012
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
A User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHubA User Interface for adding Machine Learning tools into GitHub
A User Interface for adding Machine Learning tools into GitHub
 
Go at Skroutz
Go at SkroutzGo at Skroutz
Go at Skroutz
 
Infinum Android Talks #02 - How to write an annotation processor in Android
Infinum Android Talks #02 - How to write an annotation processor in AndroidInfinum Android Talks #02 - How to write an annotation processor in Android
Infinum Android Talks #02 - How to write an annotation processor in Android
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
Cordova: APIs and instruments
Cordova: APIs and instrumentsCordova: APIs and instruments
Cordova: APIs and instruments
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to Java
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2
 
Design Patterns for Pods and Containers in Kubernetes - Webinar by zekeLabs
Design Patterns for Pods and Containers in Kubernetes - Webinar by zekeLabsDesign Patterns for Pods and Containers in Kubernetes - Webinar by zekeLabs
Design Patterns for Pods and Containers in Kubernetes - Webinar by zekeLabs
 
Enhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_os
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
Effectively using Open Source with conda
Effectively using Open Source with condaEffectively using Open Source with conda
Effectively using Open Source with conda
 

More from CommonsWare

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable Projects
CommonsWare
 

More from CommonsWare (20)

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable Projects
 
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
 
Android Security: Defending Your Users
Android Security: Defending Your UsersAndroid Security: Defending Your Users
Android Security: Defending Your Users
 
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
 
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
 
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
 
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
 
X Means Y
X Means YX Means Y
X Means Y
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of Wearables
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipher
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFC
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly Bean
 
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
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

Android: Reuse Models

  • 1.     Droidcon UK 2010 Android Reuse Models
  • 2.     Why Reuse? ● #1Way to Improve Overall App Quality – Establish solid patterns once, reuse often ● FasterTime to Market for Developers ● Sign of Solid Ecosystem and Community
  • 3.     Three Reuse Models ● The APK ● The JAR ● The Android Library Project
  • 4.     APK ● Expose API – Content Provider – AIDL – Intents (broadcasts, IntentService, etc.) ● Benefit – Only form of “reuse” at the app level = integration
  • 5.     APK ● Challenges – What if it is not installed? ● Semi-solution: bootstrap JAR with clean local API plus APK detection and installation assist ● What happens if user uninstalls? – Coarse-grained integration ● No frameworks, no widgets, etc.
  • 6.     JAR ● Expose Class Library – No different than traditional JARs – Developers integrate via libs/ and build path ● Benefits – Classic, battle-tested technique – Pretty easy to package up ● Eclipse or jar command
  • 7.     JAR ● Challenges – Cannot include Android resources in JARs ● Would need to distribute separately, rely on developer to unpack into project – Resource IDs determined by hosting project ● Requires reflection or pass-the-ID-via-API ● Might run into namespace collisions
  • 8.     Library Project ● Recent Addition to Android DevTools ● Purposes – Enable free/paid apps from (mostly) single code base – Support reuse...sorta
  • 9.     Library Project ● Basic Steps – Create a library project (Eclipse or android create lib-project) – Create a demo project and/or test project – Put reusable code, resources in library project – Use demo/test project(s) to confirm it works – Distribute it...somehow...
  • 10.     Library Project ● Benefits – Can distribute resources – Apparently Google's model going forward (LVL) ● Challenges – Cross-library resource collisions – Binary-only (vs. distributing source code) – How to distribute it
  • 11.     Library Projects ● Avoiding Resource Name Collisions – Prefix your resource names with something distinctive (yet, preferably, not crazy long) ● Filenames for standard resources ● android:name attributes for “values” resources – JARs: Use reflection and caching for resource ID lookups ● E.g., ParcelHelper from CWAC-Parcel
  • 12.     Library Projects ● Binary-Only Library Projects – Your library project is normal, with source code – Packaging ● Create JAR from bin/classes/ ● Put JAR in ZIP file's libs/ ● Put rest of non-source library project stuff in ZIP in proper directories ● Result: ZIP'd library project sans source
  • 13.     Library Projects ● Distribution Options – ZIP/TAR ● Necessary for the binary-only option ● Could also be used for regular project as well – Version Control Repository – Maven
  • 14.     WhatTo Distribute ● License ● Documentation ● Demo Project – Extends documentation with running code ● Clear Information – Support channels – How to get upgrades
  • 15.     A HomeTo Call Our Own ● What's Needed: Components Catalog – Entries per component with consistent metadata, links to distribution artifacts – Good search interface – Web 2.0/social hooks (tagging, rating, sharing, tweeting, etc.) – Ecosystem hooks (proprietary components?) – Goal: “go-to” place for reuse
  • 16.     WhereTo Learn More ● Android Developer Documentation – Android library projects, with or without Eclipse ● Android Parcel Project – Tips, tools, conventions for reuse – andparcel.com ● Standard Java Knowledge Bases – JARs, Maven, Ant, etc.
  • 17.     Recap ● ReuseWill Help All Long-Term – Higher-quality apps help users and the overall ecosystem – Faster-written apps help developers ● CanYou Contribute? – Write (sell?) components – Component catalog site