Class FirebaseRemoteConfigProvider

java.lang.Object
com.codename1.cloud.FirebaseRemoteConfigProvider
All Implemented Interfaces:
RemoteConfigProvider

public class FirebaseRemoteConfigProvider extends Object implements RemoteConfigProvider

A RemoteConfigProvider for Firebase Remote Config, over the same REST endpoints the Firebase web SDK uses. No native SDK, Gradle dependency or pod is involved.

The provider registers a Firebase installation once and keeps its ID and token in Preferences. Each fetch then calls the namespaces/firebase:fetch endpoint. The project ID, Web API key and app ID come from the Firebase console (google-services.json holds all three).

  • Constructor Details

    • FirebaseRemoteConfigProvider

      public FirebaseRemoteConfigProvider(String projectId, String apiKey, String appId)

      Creates a provider.

      Parameters
      • projectId: the Firebase project ID

      • apiKey: the Web API key

      • appId: the Firebase app ID, such as 1:1234:web:abcd

  • Method Details

    • setTransport

      public void setTransport(CloudHttpTransport transport)

      Replaces the HTTP transport.

      Parameters
      • transport: the transport
    • setBaseUrls

      public void setBaseUrls(String installationsUrl, String configUrl)

      Points the provider at other hosts, for tests or a proxy.

      Parameters
      • installationsUrl: replaces https://firebaseinstallations.googleapis.com

      • configUrl: replaces https://firebaseremoteconfig.googleapis.com

    • getId

      public String getId()
      Description copied from interface: RemoteConfigProvider
      Returns

      a short stable ID that keeps this provider's cache apart from others

      Specified by:
      getId in interface RemoteConfigProvider
    • fetch

      public AsyncResource<Map<String,String>> fetch()
      Description copied from interface: RemoteConfigProvider

      Fetches the current values.

      Returns

      a resource that completes with keys to string values

      Specified by:
      fetch in interface RemoteConfigProvider