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


Java Config类代码示例

本文整理汇总了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));
    }
}
 
开发者ID:rapidpro,项目名称:ureport-android,代码行数:20,代码来源:FirebaseManager.java

示例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();
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:29,代码来源:FirebaseDB.java

示例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());
}
 
开发者ID:elser,项目名称:FirebaseJUnitExample,代码行数:29,代码来源:FirebaseMocker.java

示例4: initFirebase

import com.firebase.client.Config; //导入依赖的package包/类
private void initFirebase() {
    Firebase.setAndroidContext(getApplicationContext());
    Config defaultConfig = Firebase.getDefaultConfig();
    if (!defaultConfig.isFrozen()) {
        defaultConfig.setPersistenceEnabled(true);
    }
}
 
开发者ID:googlesamples,项目名称:android-OurStreets,代码行数:8,代码来源:MainActivity.java


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