Remote Config Initialize Problem

480 views
Skip to first unread message

Ke YiWen

unread,
Feb 20, 2020, 10:07:11 AM2/20/20
to Firebase Google Group
when I call FirebaseRemoteConfig.GetValue/GetKeysByPrefix/ FetchAnsyc,it goes "ApplicationException:Internal::IsInitialized" error in android.
this is the initialize code in unity:

 protected void Start()
        {
            try
            {
                Debug.Log("firebase start init");
                FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
                {
                    dependencyStatus = task.Result;
                    if (dependencyStatus == DependencyStatus.Available)
                    {
                        InitializeFirebase();
                        Debug.Log("firebase init finish");
                    }
                    else
                    {
                        Debug.LogError(
                          "Could not resolve all Firebase dependencies: " + dependencyStatus);
                    }
                });
            }
            catch (FirebaseException e)
            {
                Debug.LogError("FirebaseException:" + e);
            }


        }

        void InitializeFirebase()
        {
            FirebaseRemoteConfig.FetchAsync().ContinueWith(task => FirebaseRemoteConfig.ActivateFetched());

            System.Collections.Generic.Dictionary<string, object> defaults = new System.Collections.Generic.Dictionary<string, object>();

            defaults.Add("config_test_string", "default local string");
            defaults.Add("config_test_int", 1);
            defaults.Add("config_test_float", 1.0);
            defaults.Add("config_test_bool", false);

            Firebase.RemoteConfig.FirebaseRemoteConfig.SetDefaults(defaults);
            DebugLog("RemoteConfig configured and ready!");
            isFirebaseInitialized = true;

        }

same problem when I use the quick-start-sample.

Patrick Martin

unread,
Feb 26, 2020, 12:38:32 PM2/26/20
to Firebase Google Group
Hi Ke YiWen,

Just to verify, have you downloaded your google-services.json (Android) and/or GoogleService-Info.plist (iOS) and added it to your Assets/ directory? See this section of the setup or the associated video.

I've gotten the error you describe in the quickstart project too, but it went away when I added that configuration file. Let me know if this doesn't resolve your issue or if you've already done this and we can dive a little deeper into what might be happening.

Thanks,
--Patrick

Patrick Martin

unread,
Feb 26, 2020, 12:38:47 PM2/26/20
to Firebase Google Group
Hi Ke YiWen,

Just to verify, have you downloaded your google-services.json (Android) and/or GoogleService-Info.plist (iOS) and added it to your Assets/ directory? See this section of the setup or the associated video.

I've gotten the error you describe in the quickstart project too, but it went away when I added that configuration file. Let me know if this doesn't resolve your issue or if you've already done this and we can dive a little deeper into what might be happening.

Thanks,
--Patrick

On Thursday, February 20, 2020 at 8:07:11 AM UTC-7, Ke YiWen wrote:
Reply all
Reply to author
Forward
0 new messages