Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The making of an Android library: Download Manager v2

The making of an Android library: Download Manager v2

Android allows developers to add download functionality to their apps, but if you want to extend that behaviour, or customise it to your liking — that’s not easy. That’s why at Novoda we created an improved version of the Download Manager.

This is the perfect example to see how Android developers can share common code between more projects through an Android Library. In this deck I show how to get started creating a library, what are the difficulties we encountered and finally how to publish and share the library between multiple projects.


April 05, 2019

More Decks by danybony

Other Decks in Programming


  1. The making of an Android library: Download Manager v2 Daniele

  2. Daniele Bonaldo

  3. Why?

  4. Why?

  5. Why?

  6. Why?

  7. Why?

  8. Why?

  9. Why?

  10. How?

  11. Extract library code How?

  12. Extract library code

  13. Dedicated project

  14. Libraries repository

  15. Fork existing library

  16. Fork existing library

  17. Novoda’s Download Manager

  18. Novoda’s Download Manager • Fork from AOSP Download Manager •

    Downloads to internal storage • Multiple files grouped in batches • Client app rules for download start/resume
  19. Novoda’s Download Manager • Entirely rewritten • Easier batching •

    More control for client app: • download rules • notifications customisation • storage location • Replaced SQLite with Room • Better API for downloads status querying • Goodbye Content Provider v2
  20. Defaults

  21. Defaults

  22. Defaults

  23. Demo app

  24. Maintenance

  25. Open-source Maintenance

  26. Clear readme • Dependency definition • Sample usage • Most

    common use cases • Important information for first time users
  27. Contributions • Be present • Address comments, ask for details

    if needed • Be opinionated, but 

  29. Continuous Integration • Static analysis • Tests • Pull Request

    Builder • Releases
  30. Release

  31. Release

  32. https://github.com/novoda/bintray-release Novoda bintray-release plugin

  33. Semantic versioning 2.1.0 Major Minor Patch

  34. Standard release flow 1.0.0 1.1.0-SNAPSHOT Library update Snapshot release Test

    in client project Issue detected 1.1.0 release
  35. Composite builds

  36. Standard release flow 1.0.0 1.1.0-SNAPSHOT Library update Test in client

    project Issue detected 1.1.0 release
  37. Automated release • Snapshot releases for develop branch • Public

    version releases for release branch
  38. Conclusions

  39. Conclusions • Libraries • Small scope • Prevent coupling •

    Reuse solutions • Create • Dedicated module • Fork existing one • Generalise / evolve • Demo app! • Open source • Clear readme • Templates • Continuous Integration • Release • Semantic versioning • Composite builds • Automated releases
  40. Daniele Bonaldo Thank You! @danybony_ danybony danielebonaldo.com