简体   繁体   English

是否可以在开始下载之前获取动态功能模块大小?

[英]Is it possible to get an on dynamic feature module size before starting to download it?

I would like to know if it is currently possible to know the on dynamic feature module size before we start to download it.我想知道目前是否可以在我们开始下载之前知道动态功能模块的大小。 I didn't find an answer to it anywhere on the web =/.我在网络上的任何地方都找不到答案=/。

NO.不。

But there is a hack for it.但是有一个破解方法。

  1. If your dynamic module size < 10MB如果您的动态模块大小 < 10MB
  2. call SplitInstallRequest builder in the background on App launch.在 App 启动时在后台调用 SplitInstallRequest 构建器。
  3. implement SplitInstallStateUpdatedListener onStateUpdate() call back.实现 SplitInstallStateUpdatedListener onStateUpdate() 回调。
  4. in SplitInstallSessionStatus.DOWNLOADING state you get size of your module.在 SplitInstallSessionStatus.DOWNLOADING 状态下,您可以获得模块的大小。
  5. install your module by SplitCompat.install(context) when user want to use it.当用户想要使用它时,通过 SplitCompat.install(context) 安装你的模块。

Note: This approach violate the rule of dynamic delivery But you can consider it as per your requirement or need.注意:这种方法违反了动态交付的规则,但您可以根据您的要求或需要考虑它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM