Home

Awesome

Xamarin.Plugin.Firebase.RemoteConfig

Cross-platform library for using Firebase RemoteConfig in Xamarin Forms applications. The plugin provides a simple facade to official Xamarin bindings for Firebase native libs.

Platform support

This plugin is compatible with iOS and Android.

Quickstart

Setup

API Usage

Call CrossFirebaseRemoteConfig.Current from PCL or client code to use APIs.

/// <summary>
/// Initializes the service.
/// </summary>
/// <param name="defaultConfigResourceName">If set, load defaults from this resource</param>
/// <param name="developerModeEnabled">If set to <c>true</c> developer mode is enabled.</param>
void Init(string defaultConfigResourceName = null, bool developerModeEnabled = false);

/// <summary>
/// Initializes the service without default config.
/// </summary>
/// <param name="developerModeEnabled">If set to <c>true</c> developer mode is enabled.</param>
void Init(bool developerModeEnabled = false);

/// <summary>
/// Fetchs the remote config.
/// </summary>
/// <param name="cacheExpiration">Cache expiration in seconds.</param>
/// <exception cref="FirebaseRemoteConfigFetchFailedException">when fetch fails.</exception>
Task FetchAsync(long cacheExpiration);

/// <summary>
/// Activates the last fetched config.
/// </summary>
void ActivateFetched();

/// <summary>
/// Gets the value with specified key as string.
/// </summary>
string GetString(string key);

/// <summary>
/// Gets the value with specified key as byte array.
/// </summary>
byte[] GetBytes(string key);

/// <summary>
/// Gets the value with specified key as boolean.
/// </summary>
bool GetBool(string key);

/// <summary>
/// Gets the value with specified key as long.
/// </summary>
long GetLong(string key);

/// <summary>
/// Gets the value with specified key as double.
/// </summary>
double GetDouble(string key);

/// <summary>
/// Gets all keys by prefix.
/// </summary>
ICollection<string> GetKeysByPrefix(string prefix);

iOS

Firebase.Core.App.Configure();
CrossFirebaseRemoteConfig.Current.Init("my_config_defaults");

Android

Firebase.FirebaseApp.InitializeApp(this);
CrossFirebaseRemoteConfig.Current.Init("my_config_defaults");

License

Licensed under MIT, see license file.