我为我的旧应用程序实现了Firebase远程配置,该应用程序已经使用Firebase崩溃分析和Firebase分析。这些服务都能正常工作,但是在使用远程配置时,我遇到了此身份验证令牌错误。
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)
我会尽力为您进行翻译,以下是翻译的结果:
我按照一个谷歌文档上的实现指南进行操作。我不确定是否漏掉了一步或多步。这是我的代码。
应用程序类
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);
}
}
我正在主屏幕片段中使用fetch请求。我在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();
}
}
});
}
有人能指出我错过了什么吗?在Firebase方面是否还有其他配置我错过了?