SlideShare a Scribd company logo
1 of 17
Download to read offline
   
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
 
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 ...
 
"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...
 
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

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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)
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

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