Android device specific module

Author: IonutNegru87Created Feb 16, 2017Updated Dec 4, 2020

Hello,

This is intended to be more of an open discussion, than an actual issue. I want to add some Android specific components in the project, like the Bluetooth and I want to keep the clean architecture. Currently I have 4 modules:

  • common - utility stuff that can be used by all the modules (even other projects) - pure Java
  • data - everything related to data
  • domain - entities, use cases, repositories
  • presentation - everything related to the UI

I was thinking to add these to the data module, but this could be out of scope for that module as it will handle other things beside data.

On a presentation made by Tomislav Homan, I've read that a new module could be added which can include Android stuff such as sensors, alarms, notifications, players, all kinds of Managers, and so on. Something like a device module which should have the actual implementation of the Android specific stuff and expose it via Observables or interfaces.

What do you think it is the best approach for this in order to keep the clean architecture and to respect the dependency rule. If you know/have examples with source code that will be even greater.

Source: android10/Android-CleanArchitecture