protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            mPriceTextView = (TextView)FindViewById(Resource.Id.priceView);

            Button fetchButton = (Button)FindViewById(Resource.Id.fetchButton);

            fetchButton.Click += async delegate
            {
                await FetchDiscount();
            };


            // Get Remote Config instance.
            // [START get_remote_config_instance]
            mFirebaseRemoteConfig = FirebaseRemoteConfig.Instance;
            // [END get_remote_config_instance]

            // Create Remote Config Setting to enable developer mode.
            // Fetching configs from the server is normally limited to 5 requests per hour.
            // Enabling developer mode allows many more requests to be made per hour, so developers
            // can test different config values during development.
            // [START enable_dev_mode]
            FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().Build();

            mFirebaseRemoteConfig.SetConfigSettingsAsync(configSettings).Wait();
            // [END enable_dev_mode]

            // Set default Remote Config values. In general you should have in app defaults for all
            // values that you may configure using Remote Config later on. The idea is that you
            // use the in app defaults and when you need to adjust those defaults, you set an updated
            // value in the App Manager console. Then the next time you application fetches from the
            // server, the updated value will be used. You can set defaults via an xml file like done
            // here or you can set defaults inline by using one of the other setDefaults methods.S
            // [START set_default_values]
            mFirebaseRemoteConfig.SetDefaultsAsync(Resource.Xml.remote_config_defaults).Wait();
            // [END set_default_values]

            // Fetch discount config.
            await FetchDiscount();
        }
Пример #2
0
 public Task SetDefaultsAsync(IDictionary <string, object> defaults)
 {
     return(_remoteConfig.SetDefaultsAsync(defaults.ToJavaObjectDictionary()).AsAsync());
 }