Android:Library Projects<br />Make free and paid versions with a single codebase<br />
Objective<br />What are shared libraries?<br />When are they needed?<br />What goes inside?<br />
What is a shared library?<br />Logical container for shared assets<br />To create multiple app versions<br />Hidden inside...
Why compartmentalize code?<br />Follows DRY / DIE principles<br />Promotes better architecture<br />Easy for collaborative...
Creating a library project<br />Just like creating a normal project<br />
Create a regular project<br />
Make it a library project<br />Package Explorer, Properties<br />"Android" properties group, Library<br />Set checkbox for...
Add code and resources<br />
Create the manifest file<br />Must declare all shared components<br />Same syntax as normal project<br />
Using the library<br />The library exists, now what?<br />
Reference the library<br />Package Explorer, Properties<br />Select "Android,” Library<br />Click Add to open Project Sele...
Library ordering<br />Can reference multiple libraries<br />Must set relative priority<br />To set, use Upand Down buttons...
Declare imports in manifest<br />Must declare all components that are imported<br />Just like library’s manifest file<br /...
Structuring the FREE/PAID app<br />One way to do the popular freemium format<br />
Make three projects<br />Common (Library)<br />Almost everything goes here<br />Paid<br />All functionality like a regular...
What to put where<br />Shared Library<br />Backgrounds and other shared resources<br />Layouts for common screens<br />Sha...
What to put where<br />Shared Library “strings.xml”<br />App Projects “strings.xml”<br />Library’s resources will be repla...
Duplicates are replaced<br />Works like OOP overloading<br />Acts on activities and resources<br />Project priority matter...
Final STEPS<br />Projects exist and are linked, testing and polish remain<br />
Next steps<br />Create unit tests<br />Watch your dependencies<br />Don’t make more libraries than necessary<br />Usually ...
Next steps<br />Consider DRM for the paid version<br />Built into Google’s Android Market<br />Supported by Amazon Appstor...
Testing<br />Method one: a distinct test project<br />Set up a test project<br />Test project instruments an application p...
Final thoughts<br />Libraries are not code packages; they contain code packages<br />Overall goal is to reduce redundancie...
Working example: KeenDriver<br />Locate alt. fuel stations<br />CNG, LPG, HY, ELEC, LNG, E85, etc.<br />Filter by fuel typ...
Working example: KeenDriver<br />Free version has ads<br />No ad on map, tricky placement<br />Paid version has richer lay...
External links<br />“Adventures with Android Library Projects”<br />http://androidblogger.blogspot.com/2010/09/android-lib...
Questions?<br />Jad Meouchy<br />jad.meouchy@gmail.com<br />
Upcoming SlideShare
Loading in …5
×

Jad Meouchy on Android Libraries for Free and Paid Versions of an App

2,320 views

Published on

Jad Mouchy (jadware.com) presented at www.androiddevla.com on creating a free and paid version of an app using Android Libraries.

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
No Downloads
Views
Total views
2,320
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide

Jad Meouchy on Android Libraries for Free and Paid Versions of an App

  1. 1. Android:Library Projects<br />Make free and paid versions with a single codebase<br />
  2. 2. Objective<br />What are shared libraries?<br />When are they needed?<br />What goes inside?<br />
  3. 3. What is a shared library?<br />Logical container for shared assets<br />To create multiple app versions<br />Hidden inside the final product<br />Typically linked statically<br />
  4. 4. Why compartmentalize code?<br />Follows DRY / DIE principles<br />Promotes better architecture<br />Easy for collaborative environments<br />
  5. 5. Creating a library project<br />Just like creating a normal project<br />
  6. 6. Create a regular project<br />
  7. 7. Make it a library project<br />Package Explorer, Properties<br />"Android" properties group, Library<br />Set checkbox for "is Library"<br />Click Apply/OK<br />You can also convert an existing application project into a library.<br />
  8. 8. Add code and resources<br />
  9. 9. Create the manifest file<br />Must declare all shared components<br />Same syntax as normal project<br />
  10. 10. Using the library<br />The library exists, now what?<br />
  11. 11. Reference the library<br />Package Explorer, Properties<br />Select "Android,” Library<br />Click Add to open Project Selection dialog<br />Select from available library projects<br />
  12. 12. Library ordering<br />Can reference multiple libraries<br />Must set relative priority<br />To set, use Upand Down buttons<br />
  13. 13. Declare imports in manifest<br />Must declare all components that are imported<br />Just like library’s manifest file<br /><activity>, <service>, <receiver>, <provider>, <permission>, <uses-library>, etc.<br />Use fully-qualified package names, like com.example.app.MainActivity instead of .MainActivity<br />
  14. 14. Structuring the FREE/PAID app<br />One way to do the popular freemium format<br />
  15. 15. Make three projects<br />Common (Library)<br />Almost everything goes here<br />Paid<br />All functionality like a regular app<br />DRM, if applicable<br />Free<br />Special manifest permissions for ads<br />AdMob conditional inclusions<br />Different layouts as needed<br />Alternate settings<br />
  16. 16. What to put where<br />Shared Library<br />Backgrounds and other shared resources<br />Layouts for common screens<br />Shared activities<br />Helper functions<br />3rd-party libraries<br />Settings Activity<br />App Projects<br />Title images depicting version<br />Unique string resources<br />Ads (if applicable)<br />Settings XML<br />
  17. 17. What to put where<br />Shared Library “strings.xml”<br />App Projects “strings.xml”<br />Library’s resources will be replaced by those in app project => easy version testing<br />
  18. 18. Duplicates are replaced<br />Works like OOP overloading<br />Acts on activities and resources<br />Project priority matters!<br />Current project gets highest priority (expected behavior)<br />
  19. 19. Final STEPS<br />Projects exist and are linked, testing and polish remain<br />
  20. 20. Next steps<br />Create unit tests<br />Watch your dependencies<br />Don’t make more libraries than necessary<br />Usually you only need one<br />
  21. 21. Next steps<br />Consider DRM for the paid version<br />Built into Google’s Android Market<br />Supported by Amazon Appstore<br />
  22. 22. Testing<br />Method one: a distinct test project<br />Set up a test project<br />Test project instruments an application project that depends on the library<br />Add tests to the project for library-specific features<br />Method two: integrated testing<br />Set up a standard project that depends on the library<br />Put instrumentation into that project<br />Self-contained project will contain both tests/instrumentations and the code to test<br />
  23. 23. Final thoughts<br />Libraries are not code packages; they contain code packages<br />Overall goal is to reduce redundancies<br />Not everything will go into a library<br />
  24. 24. Working example: KeenDriver<br />Locate alt. fuel stations<br />CNG, LPG, HY, ELEC, LNG, E85, etc.<br />Filter by fuel type and public/private<br />15,000 stations around USA, AU, DE<br />
  25. 25. Working example: KeenDriver<br />Free version has ads<br />No ad on map, tricky placement<br />Paid version has richer layout<br />Paid version has more settings<br />Paid version: less than 50 LOC<br />
  26. 26. External links<br />“Adventures with Android Library Projects”<br />http://androidblogger.blogspot.com/2010/09/android-library-projects.html<br />“Managing Projects from Eclipse with ADT”<br />http://developer.android.com/guide/developing/projects/projects-eclipse.html<br />“Testing from Eclipse with ADT” (O.T.)<br />http://developer.android.com/guide/developing/testing/testing_eclipse.html<br />
  27. 27. Questions?<br />Jad Meouchy<br />jad.meouchy@gmail.com<br />

×