Kusan
Kusan

Reputation: 260

Android App Bundle new language

I've updated my application to the new Android App Bundle. I've uploaded a new App Bundle in the internal test track.

And now when I add a new language to my phone, it doesn't download the associated language for my app like we could expect it.

Is it specified when the new language will be downloaded?

Thanks in advance.

Upvotes: 4

Views: 949

Answers (2)

qianlv
qianlv

Reputation: 550

First, you need to add play core dependency in your app. And follow the sample code

  1. request language module

    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)
    
  2. install split in your application and activity

    override fun attachBaseContext(newBase: Context) {
       val ctx = LanguageHelper.getLanguageConfigurationContext(newBase)
       super.attachBaseContext(ctx)
       SplitCompat.installActivity(this)
    }
    

You should reference doc and dynamic bundle demo doc

Upvotes: 1

Jimale Abdi
Jimale Abdi

Reputation: 2864

When downloading the App if the language is not available in the Phone, Google Play was removing that language from the App because the language isn't installed on the phone.

In case you only want to show specific languages for your app, You can set it in argument as shown below in build.gradle file.

defaultConfig { 
     resConfigs "en", "ar", "fr"          
}

Upvotes: 3

Related Questions