本文整理匯總了Java中com.google.firebase.remoteconfig.FirebaseRemoteConfig.setConfigSettings方法的典型用法代碼示例。如果您正苦於以下問題:Java FirebaseRemoteConfig.setConfigSettings方法的具體用法?Java FirebaseRemoteConfig.setConfigSettings怎麽用?Java FirebaseRemoteConfig.setConfigSettings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.firebase.remoteconfig.FirebaseRemoteConfig
的用法示例。
在下文中一共展示了FirebaseRemoteConfig.setConfigSettings方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fetchFirebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
private void fetchFirebase() {
FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.getInstance();
remoteConfig.setConfigSettings(
new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build());
remoteConfig.fetch()
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
remoteConfig.activateFetched();
setup();
} else {
Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), "Da ist was schiefgelaufen.\nVersuche es noch einmal...", Snackbar.LENGTH_SHORT);
View snackbarView = snackbar.getView();
snackbarView.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), theme().primaryColorDark));
snackbar.show();
}
});
}
示例2: provideFirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
@Provides @Singleton @Nullable
public FirebaseRemoteConfig provideFirebaseRemoteConfig() {
try {
FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings settings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
config.setConfigSettings(settings);
return config;
} catch (IllegalStateException ex) {
/* When there is no google-secrets.json file found, the library throws an exception
* here which causes insta-crashes for us. Silently recover here...
*/
TbaLogger.e("Unable to find google-secrets.json, disabling remote config");
return null;
}
}
示例3: newInstance
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
static FirebaseConfig newInstance(Config.State state) {
FirebaseRemoteConfig firebase = FirebaseRemoteConfig.getInstance();
firebase.setConfigSettings(buildSettings());
firebase.setDefaults(R.xml.remote_config_defaults);
return new FirebaseConfig(firebase, state);
}
示例4: setupFirebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
private void setupFirebase() {
final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
firebaseRemoteConfig.fetch(3600).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) firebaseRemoteConfig.activateFetched();
}
});
}
示例5: newInstance
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
public static FirebaseConfig newInstance() {
final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
return new FirebaseConfig(firebaseRemoteConfig);
}
示例6: doInBackground
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
@Override
protected Void doInBackground(Void... voids) {
// Bug tracking
CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
Fabric.with(LWQApplication.get(), new Crashlytics.Builder().core(core).build());
// ImageLoader Requires Disk Access to Initialize
LWQImageControllerHelper.get();
// Remote Config
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
// Firebase Analytics
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(LWQApplication.get());
firebaseAnalytics.setAnalyticsCollectionEnabled(!BuildConfig.DEBUG);
firebaseAnalytics.setMinimumSessionDuration(1000);
// AdMob
MobileAds.initialize(getApplicationContext(), getString(R.string.admob_app_id));
MobileAds.setAppMuted(true);
// Enable
setComponentsEnabled(!LWQPreferences.isFirstLaunch());
// Cache images if FTUETask completed
if (!LWQPreferences.isFirstLaunch()) {
cacheRemoteImageAssets();
}
return null;
}
示例7: fetchRemoteConfigs
import com.google.firebase.remoteconfig.FirebaseRemoteConfig; //導入方法依賴的package包/類
private void fetchRemoteConfigs() {
ServerConfigsHelper.removeAPIEndpoint(FavouriteJourneysActivity.this);
FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
firebaseRemoteConfig.setConfigSettings(configSettings);
firebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);
long cacheExpiration = 720; // 1/5 hour in seconds.
if (firebaseRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
Log.d("fetchRemoteConfigs: changing cache expiration");
cacheExpiration = 0;
}
firebaseRemoteConfig.fetch(cacheExpiration)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
firebaseRemoteConfig.activateFetched();
} else {
// FirebaseCrash.report(new Exception("Firebase Remote Config FAILED in ADDONCOMPLETELISTENER"));
}
if (firebaseRemoteConfig.getBoolean(FIREBASE_IS_STRIKE_SET)) {
updateDashboard(firebaseRemoteConfig.getString(FIREBASE_STRIKE), ViewsUtils.COLORS.RED, false, false);
} else if (firebaseRemoteConfig.getBoolean(FIREBASE_IS_MAINTENANCE_SET)) {
updateDashboard(firebaseRemoteConfig.getString(FIREBASE_MAINTENANCE), ViewsUtils.COLORS.ORANGE, false, false);
} else if (firebaseRemoteConfig.getLong(FIREBASE_LATEST_VERSION) > BuildConfig.VERSION_CODE) {
updateDashboard(firebaseRemoteConfig.getString(FIREBASE_UPDATE_MESSAGE), ViewsUtils.COLORS.BLUE, true, false);
} else if (FirebaseRemoteConfig.getInstance().getBoolean(FIREBASE_IS_DISCOUNT_SET)) {
updateDashboard(FirebaseRemoteConfig.getInstance().getString(FIREBASE_DISCOUNT_MESSAGE), ViewsUtils.COLORS.ORANGE, false, true);
}
if (shouldDisplayDiscountMessage) {
btnIAP.setText(FirebaseRemoteConfig.getInstance().getString(FIREBASE_UPGRADE_BTN_HOME_MESSAGE).replace("\\n", System.getProperty("line.separator"))
+ " " + new String(Character.toChars(0x21AA)));
apply(btnIAP, VISIBLE);
}
})
.addOnFailureListener(this, e -> {
if (shouldDisplayDiscountMessage) {
apply(btnIAP, VISIBLE);
}
// FirebaseCrash.report(new Exception("Firebase Remote Config FAILED in ADDONFAILURELISTENER"));
});
}