Android App Bundle新语言

问题描述 投票:2回答:1

我已将我的应用程序更新为新的Android应用程序捆绑包。我已经在内部测试轨道中上传了一个新的App Bundle。

现在,当我向手机添加新语言时,它不会像我们期望的那样下载与我的应用程序相关的语言。

是否指定了何时下载新语言?

提前感谢。

android android-studio android-app-bundle
1个回答
0
投票

首先,您需要在应用中添加播放核心依赖项。并遵循示例代码1,请求语言模块

val manager = SplitInstallManagerFactory.create(this)
// Skip loading if the module already is installed. Perform success action     directly.
if (manager.installedModules.contains(targetLocalName)) {
    onSuccessfulLoad(targetLocalName)
    return
}

val request = SplitInstallRequest.newBuilder()
    .addModule(targetLocalName)
    .build()

// Load and install the requested feature module.
manager.startInstall(request)
  1. 在您的应用程序和活动中安装拆分

    覆盖有趣的attachBaseContext(newBase:Context){ val ctx = LanguageHelper.getLanguageConfigurationContext(newBase) super.attachBaseContext(ctx) SplitCompat.installActivity(this)}

您应该参考文档和动态捆绑包演示doc

© www.soinside.com 2019 - 2024. All rights reserved.