Reputation: 11124
Sometimes we just want to change some strings. However, we have to recompile and resign app and upload to Play Store. User also have to download and update too.
I think Firebase remote config is an interesting solution. But it seem that remote-config cannot update string.xml it self.
Any solution?
Upvotes: 4
Views: 2157
Reputation: 1154
As the accepted answer stated there is not official way to do that ,
But since you wanted a firebase solution here is a universal library that does just that Telereso , it also controls images .
add to build.gradle
// At your root build.gradle
allprojects {
repositories {
// add JitPack repository
maven { url 'https://jitpack.io' }
jcenter()
google()
}
}
// At your app build.gradle
implementation("io.telereso:telereso:1.0.1-alpha")
Init
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Telereso.init(this)
}
}
It support globally changing strings out of the box by adding this to styles
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/style_color_primary</item>
<item name="colorPrimaryDark">@color/style_color_primary_dark</item>
<item name="colorAccent">@color/style_color_accent</item>
<item name="colorControlHighlight">@color/fab_color_pressed</item>
<item name="viewInflaterClass">io.telereso.android.RemoteViewInflater</item>
</style>
Or scoped changes like so
var text = Telereso.getRemoteString(R.strings.title) // if remote not found, R.string.tile will be used
Upvotes: 1
Reputation: 803
I think there is no way to update your string.xml file but you can achieve this functionality via your api requests. So this way your every strings will be api driven and you can change whenever you want to. There is one framework named proteus. So with the help of this you can generate your complete layout dynamically.
Upvotes: 2