Call dynamic feature code from base module

此生再无相见时 提交于 2019-12-11 03:44:38

问题


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)

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

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


回答1:


I'm also trying dynamic feature modules.

Here is my approach:

  1. Keep a base abstract class in base app.
  2. Implements the base class in dynamic feature.
  3. Feature feature = (Feature) Class.forName("full.class.name.FeatureImpl").newInstance();

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



来源:https://stackoverflow.com/questions/51528207/call-dynamic-feature-code-from-base-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!