当前位置: 首页>>代码示例>>Java>>正文


Java FirebaseRemoteConfigValue类代码示例

本文整理汇总了Java中com.google.firebase.remoteconfig.FirebaseRemoteConfigValue的典型用法代码示例。如果您正苦于以下问题:Java FirebaseRemoteConfigValue类的具体用法?Java FirebaseRemoteConfigValue怎么用?Java FirebaseRemoteConfigValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FirebaseRemoteConfigValue类属于com.google.firebase.remoteconfig包,在下文中一共展示了FirebaseRemoteConfigValue类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
public void getValue(final CallbackContext callbackContext, final String key, final String namespace) {
    mFirebase.cordova.getThreadPool().execute(new Runnable() {
        public void run() {
            try {
                Log.i(TAG, "Getting value " + key);
                FirebaseRemoteConfig remoteConfig = FirebaseRemoteConfig.getInstance();
                FirebaseRemoteConfigValue value = (namespace == null)
                        ? remoteConfig.getValue(key)
                        : remoteConfig.getValue(key, namespace);
                callbackContext.success(value.asString());
            } catch (Exception e) {
                Log.e(TAG, "Error getting value " + key, e);
                callbackContext.error(e.getMessage());
            }
        }
    });
}
 
开发者ID:jsayol,项目名称:cordova-plugin-firebase-sdk,代码行数:18,代码来源:RemoteConfigComponent.java

示例2: parseValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
public <T> Observable<T> parseValue(final ValueParser<T> valueParser) {
  return getValue().map(new Func1<FirebaseRemoteConfigValue, T>() {
    @Override public T call(FirebaseRemoteConfigValue remoteConfigValue) {
      return valueParser.parse(remoteConfigValue.asString());
    }
  });
}
 
开发者ID:tikivn,项目名称:ABTesting,代码行数:8,代码来源:ValueRequest.java

示例3: stringValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
public Observable<String> stringValue() {
  return getValue().map(new Func1<FirebaseRemoteConfigValue, String>() {
    @Override public String call(FirebaseRemoteConfigValue remoteConfigValue) {
      return remoteConfigValue.asString();
    }
  });
}
 
开发者ID:tikivn,项目名称:ABTesting,代码行数:8,代码来源:ValueRequest.java

示例4: booleanValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
public Observable<Boolean> booleanValue() {
  return getValue().map(new Func1<FirebaseRemoteConfigValue, Boolean>() {
    @Override public Boolean call(FirebaseRemoteConfigValue remoteConfigValue) {
      return remoteConfigValue.asBoolean();
    }
  });
}
 
开发者ID:tikivn,项目名称:ABTesting,代码行数:8,代码来源:ValueRequest.java

示例5: getValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
private Observable<FirebaseRemoteConfigValue> getValue() {
  return Observable.fromEmitter(new Action1<AsyncEmitter<FirebaseRemoteConfigValue>>() {

    @Override public void call(final AsyncEmitter<FirebaseRemoteConfigValue> asyncEmitter) {
      final Activity activity = activityWeakReference.get();
      remoteConfig.fetch(cacheExpiration).addOnFailureListener(
          activity, new OnFailureListener() {
            @Override public void onFailure(@NonNull Exception e) {
              asyncEmitter.onError(e);
            }
          }).addOnSuccessListener(activity, new OnSuccessListener<Void>() {
        @Override public void onSuccess(Void aVoid) {
          remoteConfig.activateFetched();
          asyncEmitter.onNext(remoteConfig.getValue(key));
        }
      }).addOnCompleteListener(
          activity, new OnCompleteListener<Void>() {
            @Override public void onComplete(@NonNull Task<Void> task) {
              asyncEmitter.onCompleted();
            }
          });

      asyncEmitter.setCancellation(new AsyncEmitter.Cancellable() {
        @Override public void cancel() throws Exception {
          activityWeakReference.clear();
        }
      });
    }
  }, AsyncEmitter.BackpressureMode.BUFFER)
      .timeout(timeout, TimeUnit.MILLISECONDS)
      .onErrorResumeNext(new Func1<Throwable, Observable<? extends FirebaseRemoteConfigValue>>() {
        @Override
        public Observable<? extends FirebaseRemoteConfigValue> call(Throwable throwable) {
          return Observable.just(remoteConfig.getValue(key));
        }
      });
}
 
开发者ID:tikivn,项目名称:ABTesting,代码行数:38,代码来源:ValueRequest.java

示例6: getValue

import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue; //导入依赖的package包/类
public static Single<FirebaseRemoteConfigValue> getValue(@NonNull String key) {
    return Single.fromCallable(() -> FirebaseRemoteConfig.getInstance().getValue(key))
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread());
}
 
开发者ID:Goddchen,项目名称:RxFireDroid,代码行数:6,代码来源:RxFireDroidRemoteConfig.java


注:本文中的com.google.firebase.remoteconfig.FirebaseRemoteConfigValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。