Java Code Examples for com.google.firebase.remoteconfig.FirebaseRemoteConfig#getBoolean()

The following examples show how to use com.google.firebase.remoteconfig.FirebaseRemoteConfig#getBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From snippets-android with Apache License 2.0 6 votes vote down vote up
public void executeAdsPolicy() {
    // [START pred_ads_policy]
    FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
    String adPolicy = config.getString("ads_policy");
    boolean will_not_spend = config.getBoolean("will_not_spend");
    AdView mAdView = findViewById(R.id.adView);

    if (adPolicy.equals("ads_always") ||
            (adPolicy.equals("ads_nonspenders") && will_not_spend)) {
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
        mAdView.setVisibility(View.VISIBLE);
    } else {
        mAdView.setVisibility(View.GONE);
    }

    FirebaseAnalytics.getInstance(this).logEvent("ads_policy_set", new Bundle());
    // [END pred_ads_policy]
}
 
Example 2
Source File: ClusterMapInfoFragment.java    From intra42 with Apache License 2.0 6 votes vote down vote up
private void updateButton() {

        if (!isAdded())
            return;

        buttonUpdate.setEnabled(true);
        buttonUpdate.setText(R.string.cluster_map_info_button_update);

        final FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
        boolean warning_42tools_enable = mFirebaseRemoteConfig.getBoolean(getString(R.string.firebase_remote_config_warning_42tools_enable));
        if (activity.haveErrorOnLayer.contains(activity.layerSettingsInProgress.layer) && !warning_42tools_enable) {
            buttonUpdate.setEnabled(true);
            buttonUpdate.setText(R.string.retry);
        } else if (activity.layerSettings.equals(activity.layerSettingsInProgress)) {
            buttonUpdate.setEnabled(false);
            buttonUpdate.setText(R.string.cluster_map_info_button_update_disabled);
        }
    }
 
Example 3
Source File: MainActivity.java    From snippets-android with Apache License 2.0 5 votes vote down vote up
public String getPromotedBundle() {
    FirebaseAnalytics.getInstance(this).logEvent("promotion_set", new Bundle());

    FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
    String promotedBundle = config.getString("promoted_bundle");
    boolean will_spend = config.getBoolean("predicted_will_spend");

    if (promotedBundle.equals("predicted") && will_spend) {
        return "premium";
    } else {
        return promotedBundle;
    }
}
 
Example 4
Source File: MainActivity.java    From snippets-android with Apache License 2.0 5 votes vote down vote up
public void executeGiftPolicy() {
    FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
    String giftPolicy = config.getString("gift_policy");
    boolean willChurn = config.getBoolean("will_churn");

    if (giftPolicy.equals("gift_achievement")) {
        grantGiftOnLevel2();
    } else if (giftPolicy.equals("gift_likelychurn") && willChurn) {
        grantGiftNow();
    }

    FirebaseAnalytics.getInstance(this).logEvent("gift_policy_set", new Bundle());
}