Sunday, 24 January 2021

Firebase remote config fetch failed with FirebaseRemoteConfigClientException

I implemented the firebase remote config for my old application which already using firebase crashlytics and firebase analytics. Those services are working fine. Buth with the remote config I'm getting this auth token error.

com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch.
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler.lambda$fetchIfCacheExpiredAndNotThrottled$1(ConfigFetchHandler.java:209)
at com.google.firebase.remoteconfig.internal.ConfigFetchHandler$$Lambda$2.then(Unknown Source:8)
at com.google.android.gms.tasks.zzg.run(com.google.android.gms:play-services-tasks@@17.0.2:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: com.google.firebase.installations.FirebaseInstallationsException: Firebase Installations Service is unavailable. Please try again later.
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(FirebaseInstallationServiceClient.java:147)
at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(FirebaseInstallations.java:490)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:361)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:351)
at com.google.firebase.installations.FirebaseInstallations$$Lambda$4.run(Unknown Source:4)

I followed the implementation guide on a google document. I'm not sure whether I missed any step. here's my code.

ApllicationClass

public class Global extends Application {

    public static FirebaseRemoteConfig REMOTE_CONFIG = null;

    @Override
    public void onCreate() {
        super.onCreate();

        REMOTE_CONFIG = FirebaseRemoteConfig.getInstance();
        FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                .setMinimumFetchIntervalInSeconds(3600)
                .build();
        REMOTE_CONFIG.setConfigSettingsAsync(configSettings);
        REMOTE_CONFIG.setDefaultsAsync(R.xml.remote_config_defaults);
    }
}

And I'm using the fetch request in the home screen fragment. I'm calling the below method in onViewCreated

private void getRemoteConfig(){

        Global.REMOTE_CONFIG.fetchAndActivate().addOnCompleteListener(requireActivity(), task -> {

            if (task.isSuccessful()) {
                String home_screen_status = Global.REMOTE_CONFIG.getString("home_screen_status");
            }else{
                try {
                    throw task.getException();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    } 

Can someone point me out what am I missing? Is there any other configuration I have to do on firebase side that I'm missing?



from Firebase remote config fetch failed with FirebaseRemoteConfigClientException

No comments:

Post a Comment