Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Latest commit

 

History

History
50 lines (35 loc) · 2.63 KB

CONFIGURE_FIREBASE.md

File metadata and controls

50 lines (35 loc) · 2.63 KB

Configuring the Firebase Remote Controller

There are three steps to being able to use the Firebase Remote Controller with Remixer for Android:

  1. Install the Firebase Remote Controller on a Firebase Instance.
  2. Get your Firebase credentials
  3. Set up Remixer synchronization to use the Firebase Remote.

Step 1: Install Remote Controller on Firebase

This is out of the scope of this document, as it is properly documented in the remote's repo.

Step 2: Get your Firebase credentials

  • Go to your Firebase console and click on the Firebase App where you have uploaded the Remixer Remote Controller.
  • Click Add another app and follow the instructions (you can reuse an already registered app if that is appropriate).
  • At the end you'll download a google-services.json file. Put that next to your application module's build.gradle

More detail can be found in the Firebase documentation.

Step 3: Set up Remixer synchronization

Remixer relies on implementations of SynchronizationMechanism to store and sync values. This is set on your Application class's onCreate() method.

In order to use the Remote you only need to use the correct SynchronizationMechanism, FirebaseRemoteControllerSyncer, and optionally force it to start sharing variable status immediately

import android.app.Application;
import com.google.android.libraries.remixer.Remixer;
import com.google.android.libraries.remixer.storage.FirebaseRemoteControllerSyncer;
import com.google.android.libraries.remixer.ui.RemixerInitialization;

class MyApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    RemixerInitialization.initRemixer(this);
    FirebaseRemoteControllerSyncer syncer = new FirebaseRemoteControllerSyncer(this);
    Remixer.getInstance().setSynchronizationMechanism(syncer);
    // Optionally you can start sharing your variables to the Remote automatically.
    syncer.startSharing();
  }
}

Since all the Variable Adjustment UI is completely available in the Firebase Remote Controller, if you start sharing in the Application class you may not want/need to use the RemixerFragment at all. In that case you can use FirebaseRemoteControllerSyncer#getShareLinkIntent() or FirebaseRemoteControllerSyncer#getRemoteUrl() to direct users to the remote on your own terms.

Otherwise, the RemixerFragment will automatically show options to share variables with the remote controller and share the link, see below:

Sharing UI