First I apologize for my English :-) I am working on a big project and I encountered a problem with using Firebase in my Android app. I have RemoteConfig with conditions using Analytics user property. When I set user property in app, fetch data and after it's successfully completed, I activate fetched data, I still get default value for parameters from RemoteConfig, even when RemoteConfig condition is true. Code is written in Kotlin.
This is an example of my code (this code is in onCreate() method in class, which extends Appliaction class:
FirebaseAnalytics.getInstance(this).setUserProperty("testprop", "a");
FirebaseRemoteConfig.getInstance().fetch(0).addOnCompleteListener {
if (it.isSuccessful) {
FirebaseRemoteConfig.getInstance().activateFetched();
val a = FirebaseRemoteConfig.getInstance().getString("test_param");
Log.i("TOAPP", "Test param is $a");
} else {
Log.i("TOAPP", "Error: ${it.exception?.localizedMessage}");
it.exception?.printStackTrace();
}
}
}
RemoteConfig in Firebase:
Parameter = test_param
- MyUser = develop
- Default value: = production
Condition:
MyUser - applies if User property testprop exactly matches a
When I run this, I get this in console:
I/TOAPP: Test param is production
I have these libs in gradle.build file:
// Play services
implementation "com.google.android.gms:play-services-location:11.4.2"
implementation "com.google.android.gms:play-services-maps:11.4.2"
implementation "com.google.android.gms:play-services-base:11.4.2"
implementation "com.google.android.gms:play-services-identity:11.4.2"
implementation "com.google.android.gms:play-services-places:11.4.2"
// Firebase
implementation "com.google.firebase:firebase-core:11.4.2"
implementation "com.google.firebase:firebase-config:11.4.2"
implementation "com.google.firebase:firebase-messaging:11.4.2"
Thanks for the answers.
testprop
: applies if User property testprop exactly matches a. In the posted code, you are setting propertytestparam
. – Bob Snyderproperty
testprop. I repaired post. But code still doesn't working. – TomasBiesok