[英]Share information between dynamic feature modules
I'm starting to use dynamic feature module and I have some doubts about how I shared information between modules 我开始使用动态功能模块,并且对如何在模块之间共享信息有一些疑问
For example: 例如:
Login Module 登录模块
- Make a call to the server and get a token to make the other requests -拨打服务器并获得令牌以发出其他请求
- Get a user session -获取用户会话
Movies Module 电影模块
- Make a request to the server but needs the token that was obtained in the login module -向服务器发出请求,但需要在登录模块中获得的令牌
Is there any way that the app project knows dynamic feature module , because dependency realization is inverse 应用程序项目有什么方法可以知道动态功能模块 ,因为依赖关系的实现是相反的
Login Module <-- app 登录模块<-应用
Movies Module <-- app 电影模块<-应用
Through this dependency relationship I could not call a login module class from the movie module 通过这种依赖关系,我无法从电影模块中调用登录模块类 。
Thank you for your answers. 谢谢您的回答。
You can add sub-module in the main module like I added linkedin-sdk module in my main module. 您可以在主模块中添加子模块,就像我在主模块中添加linkedin-sdk模块一样。
Just add sub-module in settings.gradle.kts & build.gradle (module level) files. 只需在settings.gradle.kts和build.gradle(模块级别)文件中添加子模块。 setting.gradle.kts file
setting.gradle.kts文件
include(":app", ":linkedin-sdk")
build.gradle file build.gradle文件
implementation(project(":linkedin-sdk"))
In your case, if you want to access all data of login module then you have to make login module as a sub-module. 在您的情况下,如果要访问登录模块的所有数据,则必须将登录模块作为子模块。
Note: It is an example of build.gradle.kts 注意:这是build.gradle.kts的示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.