Search code examples
androidfirebasefirebase-remote-config

problem at the first launch RemoteConfig with conditions


I am facing an issue with the RemoteConfig param which has conditions. Most of the time, I get the default value at the first app open. After that, I get the other condition values. My conditions are User in random percentile from 0 -> 10, 10 -> 20, 20 -> 30,...., 90 -> 100. As my opinion, it's should never be the default value (because the conditions cover 100% of user percentile). I did call fetchAndActive() and call mFirebaseRemoteConfig.getString() after task.isSuccessful(). Any idea?


Solution

  • after a lot of days on searching, but there's no clue about it, I had to do a dirty, tricky method to solve my issue: fetch and load the remote config after 1s on onCreate:

    Observable.timer(1, TimeUnit.SECONDS)
                        .observeOn(AndroidSchedulers.mainThread())
                        .doOnNext(time ->{
                            fetchAndActiveRemoteConfig();
                        })
                        .subscribe();
    

    P/s: it works but I dont know why it works.