Android App Bundle with in-app locale change
Edit:
The PlayCore API now supports downloading the strings for another language on-demand:
https://developer.android.com/guide/playcore/feature-delivery/on-demand#lang_resources
Alternative solution (discouraged):
You can disable the splitting by language by adding the following configuration in your build.gradle
android {
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
}
This latter solution will increase the size of the app.
Handle dynamic language change within the app on android app bundle
AFAIK you can do it by using the bundle block to control which types of configuration APKs you want your app bundle to support.
Based on the documentation:
android {
...
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
}
Xamarin.Android - Can't change app locale after Google Play release
I finally managed to found a solution and fix my issue.
First, I have added this file BundleConfig.json
to my project.
{
"optimizations": {
"splitsConfig": {
"splitDimension": [{
"value": "LANGUAGE",
"negate": true
}]
}
}
}
Second, I edited my project's csproj file, adding a AndroidBundleConfigurationFile item under the release PropertyGroup.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
...
<AndroidBundleConfigurationFile>BundleConfig.json</AndroidBundleConfigurationFile>
</PropertyGroup>
Then, I saved the solution, recreated my aab bundle, and locales were being changed correctly on release mode.
Sources:
https://learn.microsoft.com/en-us/xamarin/android/release-notes/10/10.3#support-for-android-app-bundle-configuration-files
https://developer.android.com/studio/build/building-cmdline#bundleconfig
How does an app Bundle handle Language changes?
If the app is foreground when the download finishes, Play Store will not install the additional language, because that would kill the app. Instead, the installation will happen at some point later.
Using Android App Bundle how do i get the system to download a new language when the system language is changed
It can take a little while (usually around 24 hours) for the Play Store to catch up with the language change. If you're okay with that delay, then you don't need to do anything.
Otherwise you can use the code provided in the official sample to guide you in your own implementation.
Change language programatically in Android not working for APK generated from App bundle format
Edit:
The PlayCore API now supports downloading the strings for another language on-demand: https://developer.android.com/guide/app-bundle/playcore#lang_resources
I found the solution here. Copying from there
For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle
android {
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
}
}
Related Topics
Android Studio - Creating Modules Without Copying Files
Convert Bitmap Array to Yuv (Ycbcr Nv21)
Disabling Android O Auto-Fill Service for an Application
How to Handle Ontouch Event for Map in Google Map API V2
Overriding Referenced Style Attributes
Android Textview:"Do Not Concatenate Text Displayed with Settext"
Android: Collapsingtoolbarlayout and Swiperefreshlayout Get Stuck
How to Set the Initial Zoom/Width for a Webview
How to Know That My Webview Is Loaded 100%
List All the Files from All the Folder in a Single List
Android Displaymetrics Returns Incorrect Screen Size in Pixels on Ics
How to Run Countdowntimer in a Service in Android
How to Call Methods of a Service from Activity
Get Application Context Returns Null
Android Device Gps On/Off Programmatically
Vertical Line Using Xml Drawable
Creating Viewholders for Listviews with Different Item Layouts