I use remote config and it has worked well.
However all of sudden, it doesn't work and value that gets from remote config becomes null, so it kills the app.
After I use try-catch, app is no longer killed.
But still I can't get value from remote config since it is null.
However when I run my app on debug mode, if I print value from remote config, it is not null, it gets value perfect.
Only problem happens on production mode.
So I can't check what is the problem here, and don't know why all of sudden, it is no longer worked.
Below is my remote config code.
remoteConfig = Firebase.remoteConfig
val configSettings = remoteConfigSettings {
minimumFetchIntervalInSeconds = 3600L
}
remoteConfig.setConfigSettingsAsync(configSettings)
remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val gson = GsonBuilder().create()
val result = remoteConfig.getString("app_update")
val resultJson = gson.fromJson(result, AppUpdate::class.java)
if (resultJson != null) {
try {
val remoteAppVersion = resultJson.app_version?.toInt()
val remoteForceUpdate = resultJson.force_update
// 현재 버전이 remote config 버전보다 낮을 경우
if (currentAppVersion < remoteAppVersion!! && remoteForceUpdate!!) {
// 즉시 업데이트할 것
val window = this.window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.parseColor("#B3000000"))
binding.updateLayout.visibility = View.VISIBLE
val upAnimation =
AnimationUtils.loadAnimation(this, R.anim.slide_up_enter)
binding.updateCardLayout.startAnimation(upAnimation)
} else {
// 현재 버전이 remote config 버전보다 낮지 않을 경우
binding.updateLayout.visibility = View.GONE
}
} catch (e: Exception) {
e.printStackTrace()
}
}
} else {
// remote config에서 버전을 가져오지 못한 경우
}
}
The thing that I assume as the reason is I changed compileSDK version from 32 to 33, minSdkVersion from 31 to 26. (my targetSdkversion is 31).
And It feels like after that, remote config is not working in production.
Is there any guess on this? or is there any way of knowing what causes this issue?
Please help me!!