2

I have Android/kotlin multi-module project. Some of my modules are Singletone, such as Network and Analytics modules. They need Application context in order to be initialized.

I am able to initialize Koin/Kodein in app module. However, the problem is how to inject application context into each module (since app module is not visible to Network/Analytics modules).

Basically, my app module is deoendent to other modules only.

As I recently started my project, I am evaluating Koin and Kodein to see which one is helping me the way I want. That's why I am open to switch them.

halfer
  • 19,824
  • 17
  • 99
  • 186
Hesam
  • 52,260
  • 74
  • 224
  • 365
  • Can you show some code? – Salomon BRYS Nov 25 '18 at 17:13
  • @SalomonBRYS, My issue is not code dependent. That's why I didn't put any code. Let's assume that I have these modules: app, Analytics and Network. App module depends on the rest and the rest no need dependency. I create a node (in DI) that holds app context. How Network and Analytics able to get context? – Hesam Nov 26 '18 at 16:15

1 Answers1

0

Here is no dependency graph built like in Dagger: no code generation, no reflection - all is just function-bound.

Application context is available through androidContext() method.

Modules mutual dependencies logic is described here.

nyarian
  • 4,085
  • 1
  • 19
  • 51