Background
I am trying to use the new Google Firebase services to test A / B. To do this, we need to use Firebase Analytics and Firebase RemoteConfig.
Problem
Using FireBase RemoteConfig, I wanted to get variables from the server (which have different meanings for each variant of each experiment), but it seems that on some devices it gets stuck there without calling its callback (OnCompleteListener.onComplete).
I used approximately the same code as for the samples ( here ):
// init: boolean isDebug = ... ; mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(isDebug).build(); mFirebaseRemoteConfig.setConfigSettings(configSettings); final HashMap<String, Object> defaults = new HashMap<>(); for (...) defaults.put(...); mFirebaseRemoteConfig.setDefaults(defaults); //fetching the variables: long cacheExpiration = isDebug ? 0 : java.util.concurrent.TimeUnit.HOURS.toSeconds(1); mFirebaseRemoteConfig.fetch(cacheExpiration).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { //on some devices, I never get here at all if (task.isSuccessful()) { mFirebaseRemoteConfig.activateFetched(); final FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context); for (...) { String experimentVariantValue = mFirebaseRemoteConfig.getString(...); firebaseAnalytics.setUserProperty(..., experimentVariantValue); } } else { } } });
The thing is, the callback is not called, but only on some devices:
- Nexus 5 with Android 6.0.1: almost always succeeds.
- Nexus 4 with Android 5.1.1 and LG G2 with Android 4.2.2: almost always freezes (which means they don't fall into the callback)
I also found that when it works, it works in the coming sessions later.
Question
Why is this happening? What can I do to solve this problem?
android firebase firebase-remote-config
android developer
source share