从基本模块调用动态功能代码 [英] Call dynamic feature code from base module

查看:98
本文介绍了从基本模块调用动态功能代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实现一个动态功能,我应该从我的基本模块中调用该功能中的某些方法,但是只能从该功能中调用基本方法,有没有办法使功能代码可从基本中访问模块? (我知道未安装功能会发生什么情况)

im trying to implement a dynamic feature where from my base module i should call some methods in the feature, buts its only possible to call base methods from the feature, is there any way to make feature code accessible from base module? (i understand what can happen when feature is not installed)

我已经使用默认的Google文档实现了它,所以我没有不同的代码或实现方式

I've implemented it using the default google docs, so i have no different code or implementation

今天没有动态功能,我有两个.apks,我通过AIDL进行通信,我试图删除AIDL的使用并使用直接呼叫

Today without dynamic feature i have two .apks and im using communication thru AIDL, im trying to remove AIDL usage and use direct call

推荐答案

我也在尝试动态功能模块.

I'm also trying dynamic feature modules.

这是我的方法:

  1. 在基本应用程序中保留基本抽象类.
  2. 在动态功能中实现基类.
  3. Feature feature = (Feature) Class.forName("full.class.name.FeatureImpl").newInstance();

然后您可以将该实例调用到功能代码中.

Then you got the instance to call into the feature code.

这篇关于从基本模块调用动态功能代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆