Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smarongiu/Xamarin.Plugin.Firebase.RemoteConfig
Xamarin Forms bindings for Firebase RemoteConfig
https://github.com/smarongiu/Xamarin.Plugin.Firebase.RemoteConfig
Last synced: 3 months ago
JSON representation
Xamarin Forms bindings for Firebase RemoteConfig
- Host: GitHub
- URL: https://github.com/smarongiu/Xamarin.Plugin.Firebase.RemoteConfig
- Owner: smarongiu
- License: mit
- Created: 2018-09-19T15:21:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-18T12:21:12.000Z (over 3 years ago)
- Last Synced: 2024-05-13T00:14:28.343Z (6 months ago)
- Language: C#
- Size: 356 KB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xamarin-forms - Xamarin.Plugin.Firebase.RemoteConfig ★6
README
# 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
- Setup your Firebase project on https://console.firebase.google.com
- NuGet package available: https://www.nuget.org/packages/Xam.Plugin.FirebaseRemoteConfig
- Install the nuget package into your PCL/Forms project and client projects.### API Usage
Call **CrossFirebaseRemoteConfig.Current** from PCL or client code to use APIs.
```csharp
///
/// Initializes the service.
///
/// If set, load defaults from this resource
/// If set to true developer mode is enabled.
void Init(string defaultConfigResourceName = null, bool developerModeEnabled = false);///
/// Initializes the service without default config.
///
/// If set to true developer mode is enabled.
void Init(bool developerModeEnabled = false);///
/// Fetchs the remote config.
///
/// Cache expiration in seconds.
/// when fetch fails.
Task FetchAsync(long cacheExpiration);///
/// Activates the last fetched config.
///
void ActivateFetched();///
/// Gets the value with specified key as string.
///
string GetString(string key);///
/// Gets the value with specified key as byte array.
///
byte[] GetBytes(string key);///
/// Gets the value with specified key as boolean.
///
bool GetBool(string key);///
/// Gets the value with specified key as long.
///
long GetLong(string key);///
/// Gets the value with specified key as double.
///
double GetDouble(string key);///
/// Gets all keys by prefix.
///
ICollection GetKeysByPrefix(string prefix);
```### iOS
- From the Firebase Console, add your iOS app to your project.
- Download and add the generated GoogleService-Info.plist file to your app in the root folder and mark it as "BundleResource".
- Add this line to AppDelegate.cs:
```csharp
Firebase.Core.App.Configure();
CrossFirebaseRemoteConfig.Current.Init("my_config_defaults");
```
- you can add a default config file as a plist, put it in the root folder and mark it as "BundleResource".### Android
- From the Firebase Console, add your Android app to your project.
- Download and add the generated google-services.json file to your app in the root folder and mark it as "GoogleServicesJson".
- Add the nuget package https://www.nuget.org/packages/Plugin.CurrentActivity and follow installation guide.
- Add these lines to MainActivity.cs, afterbase.OnCreate(bundle)
:
```csharp
Firebase.FirebaseApp.InitializeApp(this);
CrossFirebaseRemoteConfig.Current.Init("my_config_defaults");
```
- you can add a default config file as xml resource (under Resources/xml).## License
Licensed under MIT, see license file.