Skip to content

inehemiasm/AiAssistant / .agents/skills/firebase-remote-config-basics

firebase-remote-config-basics

Verified

Comprehensive guide for Firebase Remote Config, including template management and SDK usage. Use this skill when the user needs help setting up Remote Config, managing feature flags, or updating app behavior dynamically.

FileKindSize
SKILL.mdskill md4.7 KB
references/android_setup.mdmarkdown3.4 KB
references/ios_setup.mdmarkdown2.7 KB

references/android_setup.md

View on GitHub
# Firebase Remote Config Android Setup Guide

Important references:

- Refer to the `firebase-basics` skills, particularly those for project and app setup, before proceeding.

## Project and App Setup

Before you begin, ensure you have the following. If a `google-services.json` file is present, then use that Firebase project and app. Otherwise you may need to create them.

- **Firebase CLI**: Installed and logged in (see `firebase-basics`).
- **Firebase Project**: Created via `npx -y firebase-tools@latest projects:create` (see `firebase-basics`).
- **Firebase App**: Created via `npx -y firebase-tools@latest apps:create <IOS|ANDROID|WEB> <package-name-or-bundle-id>`

The `google-services.json` file must be present in the Android app's module directory. If missing, get the config using the Firebase CLI: `npx -y firebase-tools@latest apps:sdkconfig ANDROID <App-ID>`.

## Add Dependencies to Gradle Build

These changes are made to your Android project's Gradle files. Google Analytics is highly recommended as it enables conditional targeting based on user properties and audiences.

### Project-level `build.gradle.kts` (`<project>/build.gradle.kts`)

Ensure the Google Services plugin is in the `plugins` block:

```kotlin
plugins {
    // ... other plugins
    id("com.google.gms.google-services") version "4.4.0" apply false
}
```

### App-level `build.gradle.kts` (`<project>/<app-module>/build.gradle.kts`)

1.  Add the Google Services plugin to the `plugins` block:

    ```kotlin
    plugins {
        // ... other plugins
        id("com.google.gms.google-services")
    }
    ```

2.  Add the Firebase Remote Config and Analytics dependencies. Using the Firebase Bill of Materials (BoM) is the best practice for version management.

    ```kotlin
    dependencies {
        // ... other dependencies

        // Import the Firebase BoM
        implementation(platform("com.google.firebase:firebase-bom:32.7.0"))

        // Add the dependencies for Remote Config and Analytics
        implementation("com.google.firebase:firebase-config-ktx")
        implementation("com.google.firebase:firebase-analytics-ktx")
    }
    ```


## Follow up Steps

The following steps cover the essential patterns for using Remote Config effectively.

### Set In-App Defaults
Define default values so your app has functional logic before it ever fetches a template from the server. Create an XML file (e.g., `res/xml/remote_config_defaults.xml`):
    ```xml
    <!-- Example Remote Config Defaults File -->
    <?xml version="1.0" encoding="utf-8"?>
    <defaultsMap>
        <entry>
            <key>welcome_message</key>
            <value>Welcome to the app!</value>
        </entry>
        <entry>
            <key>is_feature_enabled</key>
            <value>false</value>
        </entry>
    </defaultsMap>
    ```
Then, initialize the SDK in your Activity or Application class:

    ```kotlin
    val remoteConfig = Firebase.remoteConfig
    remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)
    ```


### Fetch and Activate Values
To apply values from the cloud, you must fetch them and then activate them.
    ```kotlin
    remoteConfig.fetchAndActivate()
    .addOnCompleteListener(this) { task ->
        if (task.isSuccessful) {
            val updated = task.result
            println("Config params updated: $updated")
        } else {
            println("Fetch failed")
        }
        // Access a value
        val message = remoteConfig.getString("welcome_message")
    }
    ```
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall