2

How can I get module (sub-module / imported as a module dependency) context with module package name ?

I need a context in submodule with their own packagename (module's package name) to use.

Example : Main App (com.main.app) has a module dependency called SubApp (com.sub.app). I need to use context of com.sub.app in module but when i try to access context it always gives me with com.main.app because it is initialized in the AppController.

Is there any way to get module's context ?

Parth Patel
  • 6,498
  • 3
  • 16
  • 29
  • you can add a string value "xx" into subapp's build.gradle and read it from BuildConfig.xx in java code – aolphn Oct 16 '18 at 10:58
  • 2
    A module is a compile-time thing, and a `Context` is a runtime thing. Once your app is compiled, there is no concept of modules or module package names. All code from all source sets, modules, and libraries are combined into one entity: the app. There is no "module `Context`" as a result. So, why do you think that you need one? – CommonsWare Oct 16 '18 at 11:00
  • There's nothing called module's context. What is your exact issue? – Sarath Kn Oct 16 '18 at 11:01
  • I am using freshchat library which uses package name (context), I need to use same library in two different modules in App(Main) and also in Sub(Module) which should work different in both modules. library takes package name from context which is same as of now but it should be different to let it work diffrent manner in both modules, is there any way around it ? – Parth Patel Oct 16 '18 at 12:16

0 Answers0