npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gartorware/cordova-plugin-firebase-config

v7.0.3

Published

Cordova plugin for Firebase Remote Config

Downloads

2

Readme

Cordova plugin for Firebase Remote Config

NPM version NPM downloads NPM total downloads PayPal donate Twitter

| Donate | Your help is appreciated. Create a PR, submit a bug or just grab me :beer: | |-|-|

Index

Supported Platforms

  • iOS
  • Android

Installation

$ cordova plugin add cordova-plugin-firebase-config

Use variables IOS_FIREBASE_POD_VERSION and ANDROID_FIREBASE_BOM_VERSION to override dependency versions for Firebase SDKs:

$ cordova plugin add cordova-plugin-firebase-config \
--variable IOS_FIREBASE_POD_VERSION="9.3.0" \
--variable ANDROID_FIREBASE_BOM_VERSION="30.3.1"

Adding required configuration files

Cordova supports resource-file tag for easy copying resources files. Firebase SDK requires google-services.json on Android and GoogleService-Info.plist on iOS platforms.

  1. Put google-services.json and/or GoogleService-Info.plist into the root directory of your Cordova project
  2. Add new tag for Android platform
<platform name="android">
    ...
    <resource-file src="google-services.json" target="app/google-services.json" />
</platform>
...
<platform name="ios">
    ...
    <resource-file src="GoogleService-Info.plist" />
</platform>

Preferences

You can specify FirebaseRemoteConfigDefaults in config.xml to define filename of a file with default values. Keep in mind that android and ios have different naming convensions there it's useful to specify different file names.

<platform name="android">
    ...
    <preference name="FirebaseRemoteConfigDefaults" value="remote_config_defaults" />
    <resource-file src="resources/android/remote_config_defaults.xml" target="app/src/main/res/xml/remote_config_defaults.xml" />
</platform>

<platform name="ios">
    ...
    <preference name="FirebaseRemoteConfigDefaults" value="RemoteConfigDefaults" />
    <resource-file src="resources/ios/RemoteConfigDefaults.plist" />
</platform>

On Android platform file remote_config_defaults.xml has a structure like below:

<?xml version="1.0" encoding="utf-8"?>
<defaultsMap>
    <entry>
        <key>param1</key>
        <value>value1</value>
    </entry>
    <entry>
        <key>param2</key>
        <value>value2</value>
    </entry>
</defaultsMap>

On iOS platform file RemoteConfigDefaults.plist has a structure like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>param1</key>
    <string>value1</string>
    <key>param2</key>
    <string>value2</string>
</dict>
</plist>

Variables

VALUE_SOURCE_DEFAULT

VALUE_SOURCE_DEFAULT: number

Indicates that the value returned was retrieved from the defaults set by the client.

Constant


VALUE_SOURCE_REMOTE

VALUE_SOURCE_REMOTE: number

Indicates that the value returned was retrieved from the Firebase Remote Config Server.

Constant


VALUE_SOURCE_STATIC

VALUE_SOURCE_STATIC: number

Indicates that the value returned is the static default value.

Constant

Functions

activate

activate(): Promise<boolean>

Asynchronously activates the most recently fetched configs, so that the fetched key value pairs take effect.

Example

cordova.plugins.firebase.config.activate();

Returns

Promise<boolean>

Fulfills promise with flag if current config was activated


fetch

fetch(expirationDuration): Promise<void>

Starts fetching configs, adhering to the specified minimum fetch interval.

Example

cordova.plugins.firebase.config.fetch(8 * 3600);

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | expirationDuration | number | Minimum fetch interval in seconds |

Returns

Promise<void>

Callback when operation is completed


fetchAndActivate

fetchAndActivate(): Promise<boolean>

Asynchronously fetches and then activates the fetched configs.

Example

cordova.plugins.firebase.config.fetchAndActivate();

Returns

Promise<boolean>

Fulfills promise with flag if current config was activated


getBoolean

getBoolean(key): Promise<boolean>

Returns the boolean parameter value for the given key

Example

cordova.plugins.firebase.config.getBoolean("myBool").then(function(value) {
    // use value from remote config
});

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | key | string | Parameter key |

Returns

Promise<boolean>

Fulfills promise with parameter value


getBytes

getBytes(key): Promise<ArrayBuffer>

Returns the bytes parameter value for the given key

Example

cordova.plugins.firebase.config.getBytes("myByteArray").then(function(value) {
    // use value from remote config
});

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | key | string | Parameter key |

Returns

Promise<ArrayBuffer>

Fulfills promise with parameter value


getNumber

getNumber(key): Promise<number>

Returns the number parameter value for the given key

Example

cordova.plugins.firebase.config.getNumber("myNumber").then(function(value) {
    // use value from remote config
});

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | key | string | Parameter key |

Returns

Promise<number>

Fulfills promise with parameter value


getString

getString(key): Promise<string>

Returns the string parameter value for the given key

Example

cordova.plugins.firebase.config.getString("myStr").then(function(value) {
    // use value from remote config
});

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | key | string | Parameter key |

Returns

Promise<string>

Fulfills promise with parameter value


getValueSource

getValueSource(key): Promise<number>

Returns source of the value for the specified key.

Example

cordova.plugins.firebase.config.getValueSource("myArbitraryValue").then(function(source) {
    if (source === cordova.plugins.firebase.config.VALUE_SOURCE_DEFAULT) {
        // ...
    }
});

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | key | string | Parameter key |

Returns

Promise<number>

Fulfills promise with parameter value