Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

java - FirebaseRemoteConfig getString is empty

hey guys I was having a problem with firebase remote config basically the part I blurred out has a json array that looks like this:

 [
      {
        "owner": "1",
        "platform": "android"
      },
      {
        "owner": "2",
        "platform": "ios"
      }
 ]

and then in the "onCreate" method in java I used this code here:

mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
configSettings = new FirebaseRemoteConfigSettings.Builder()
    .setMinimumFetchIntervalInSeconds(3600)
    .build();
mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);

and when I try to get the value as a string with this code:

String object = FirebaseRemoteConfig.getInstance().getString("mobile_database");

if I go in debug mode it shows that object = "" it's just an empty string is there anything that I am doing wrong?

I tried making research but I can't find anything useful?

Thanks in advance :)

PS (before someone marks it as duplicate these links did not help me :D

Is there a way to create an audience of developer builds?

getString Outside of a Context or Activity

FirebaseRemoteConfig getString returns empty but bytearray of remote config is not empty)

question from:https://stackoverflow.com/questions/66048441/firebaseremoteconfig-getstring-is-empty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are not calling the fetch method so the RemoteConfig is falling back to your local config if you have set one. See how to fetch and activate values.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...