本文整理汇总了Java中com.firebase.client.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于com.firebase.client包,在下文中一共展示了Config类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.firebase.client.Config; //导入依赖的package包/类
public static void init(Context context, boolean proxyEnabled) {
if (reference == null) {
Firebase.setAndroidContext(context);
Config config = new Config();
if (BuildConfig.DEBUG) {
config.setLogLevel(Logger.Level.DEBUG);
}
config.setPersistenceEnabled(true);
if (proxyEnabled) {
config.setAuthenticationServer(context.getString(R.string.firebase_proxy_auth));
}
Firebase.setDefaultConfig(config);
String appUrl = proxyEnabled
? context.getString(R.string.firebase_proxy_database) : context.getString(R.string.firebase_app);
reference = getInstanceWithCustomName(appUrl, context.getString(R.string.firebase_app_name));
}
}
示例2: Persist
import com.firebase.client.Config; //导入依赖的package包/类
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "False")
@SimpleProperty(userVisible = false,
description = "If true, variables will retain their values when off-line and the App " +
"exits. Values will be uploaded to Firebase the next time the App is " +
"run while connected to the network. This is useful for applications " +
"which will gather data while not connected to the network. Note: " +
"AppendValue and RemoveFirst will not work correctly when off-line, " +
"they require a network connection.<br/><br/> " +
"<i>Note</i>: If you set Persist on any Firebase component, on any " +
"screen, it makes all Firebase components on all screens persistent. " +
"This is a limitation of the low level Firebase library. Also be " +
"aware that if you want to set persist to true, you should do so " +
"before connecting the Companion for incremental development.")
public void Persist(boolean value) {
Log.i(LOG_TAG, "Persist Called: Value = " + value);
if (persist != value) { // We are making a change
if (isInitialized) {
throw new RuntimeException("You cannot change the Persist value of Firebase " +
"after Application Initialization, this includes the Companion");
}
Config config = Firebase.getDefaultConfig();
config.setPersistenceEnabled(value);
Firebase.setDefaultConfig(config);
persist = value;
resetListener();
}
}
示例3: FirebaseMocker
import com.firebase.client.Config; //导入依赖的package包/类
public FirebaseMocker() {
MockitoAnnotations.initMocks(this);
if(!initialised.get()) {
final Config config = Firebase.getDefaultConfig();
config.setEventTarget(new EventTarget() {
@Override
public void postEvent(Runnable runnable) {
runnable.run();
}
@Override
public void shutdown() {
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void restart() {
throw new UnsupportedOperationException("Not implemented");
}
});
Firebase.setDefaultConfig(config);
when(context.getApplicationContext()).thenReturn(appContext);
when(appContext.getSharedPreferences(anyString(), anyInt())).thenReturn(sharedPreferences);
Firebase.setAndroidContext(context);
initialised.set(true);
}
firebase = new Firebase(getFirebaseUrl());
}
示例4: initFirebase
import com.firebase.client.Config; //导入依赖的package包/类
private void initFirebase() {
Firebase.setAndroidContext(getApplicationContext());
Config defaultConfig = Firebase.getDefaultConfig();
if (!defaultConfig.isFrozen()) {
defaultConfig.setPersistenceEnabled(true);
}
}