當前位置: 首頁>>代碼示例>>Java>>正文


Java FirebaseRemoteConfig.setConfigSettings方法代碼示例

本文整理匯總了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();
                }
            });
}
 
開發者ID:M4lik,項目名稱:burning-series,代碼行數:20,代碼來源:MainActivity.java

示例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;
    }
}
 
開發者ID:the-blue-alliance,項目名稱:the-blue-alliance-android,代碼行數:18,代碼來源:ConfigModule.java

示例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);
}
 
開發者ID:ashdavies,項目名稱:eternity,代碼行數:9,代碼來源:FirebaseConfig.java

示例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();
        }
    });
}
 
開發者ID:Gnzlt,項目名稱:UCOmove,代碼行數:15,代碼來源:UCOmoveApplication.java

示例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);
}
 
開發者ID:novoda,項目名稱:bonfire-firebase-sample,代碼行數:10,代碼來源:FirebaseConfig.java

示例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;
}
 
開發者ID:stanidesis,項目名稱:quotograph,代碼行數:36,代碼來源:LWQApplication.java

示例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"));
                });
    }
 
開發者ID:albertogiunta,項目名稱:justintrain-client-android,代碼行數:46,代碼來源:FavouriteJourneysActivity.java


注:本文中的com.google.firebase.remoteconfig.FirebaseRemoteConfig.setConfigSettings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。