Home | History | Annotate | Download | only in api
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.tv.common.config.api;
     18 
     19 /**
     20  * Manages Live TV Configuration, allowing remote updates.
     21  *
     22  * <p>This is a thin wrapper around <a
     23  * href="https://firebase.google.com/docs/remote-config/"></a>Firebase Remote Config</a>
     24  */
     25 public interface RemoteConfig {
     26 
     27     /** Used to inject a remote config */
     28     interface HasRemoteConfig {
     29         RemoteConfig getRemoteConfig();
     30     }
     31 
     32     /** Notified on successful completion of a {@link #fetch)} */
     33     interface OnRemoteConfigUpdatedListener {
     34         void onRemoteConfigUpdated();
     35     }
     36 
     37     /** Starts a fetch and notifies {@code listener} on successful completion. */
     38     void fetch(OnRemoteConfigUpdatedListener listener);
     39 
     40     /** Gets value as a string corresponding to the specified key. */
     41     String getString(String key);
     42 
     43     /** Gets value as a boolean corresponding to the specified key. */
     44     boolean getBoolean(String key);
     45 
     46     /** Gets value as a long corresponding to the specified key. */
     47     long getLong(String key);
     48 
     49     /**
     50      * Gets value as a long corresponding to the specified key. Returns the defaultValue if no value
     51      * is found.
     52      */
     53     long getLong(String key, long defaultValue);
     54 }
     55