Is it possible to use Firebase Remote Config without having Google Play Services installed (aosp) on the device?
I did follow this setup in my android project: (via https://firebase.google.com/docs/android/setup):
- added classpath 'com.google.gms:google-services:4.3.3' into main gradle file
- added implementation 'com.google.firebase:firebase-config:19.1.3' and 'apply plugin: 'com.google.gms.google-services'' into app gradle file
It does compile, but when I initially start the app fetchAndActivate does not succeed, because task results with after calling fetch()
:
MISSING_INSTANCEID_SERVICE (Failed to get Firebase Instance ID token for fetch)
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings.Builder configBuilder = new FirebaseRemoteConfigSettings.Builder();
configBuilder.setMinimumFetchIntervalInSeconds(3600);
firebaseRemoteConfig.setConfigSettingsAsync(configBuilder.build());
HashMap<String, Object> defaults = new HashMap<>();
defaults.put("variant", "basic");
startActivity(new Intent(getApplicationContext(), CarLauncherBasic.class));
firebaseRemoteConfig.setDefaultsAsync(defaults);
firebaseRemoteConfig.fetchAndActivate()
.addOnCompleteListener(this, new OnCompleteListener<Boolean>() {
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if (task.isSuccessful()) {
boolean updated = task.getResult();
Toast.makeText(MainActivity.this, "Fetch and activate succeeded",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "Fetch failed",
Toast.LENGTH_SHORT).show();
}
String variant = firebaseRemoteConfig.getString("variant");
//
}
});
}