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


Java FirebaseFirestoreSettings类代码示例

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


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

示例1: onCreate

import com.google.firebase.firestore.FirebaseFirestoreSettings; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    LocalBroadcastManager.getInstance(this);
    FirebaseApp.initializeApp(this);
    FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
            .setPersistenceEnabled(true)
            .build();
    FirebaseFirestore.getInstance().setFirestoreSettings(settings);
}
 
开发者ID:whirlwind-studios,项目名称:School1-Android,代码行数:11,代码来源:Application.java

示例2: setup

import com.google.firebase.firestore.FirebaseFirestoreSettings; //导入依赖的package包/类
private void setup() {
    // [START get_firestore_instance]
    FirebaseFirestore db = FirebaseFirestore.getInstance();
    // [END get_firestore_instance]

    // [START set_firestore_settings]
    FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
            .setPersistenceEnabled(true)
            .build();
    db.setFirestoreSettings(settings);
    // [END set_firestore_settings]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:13,代码来源:DocSnippets.java

示例3: setUp

import com.google.firebase.firestore.FirebaseFirestoreSettings; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    FirebaseApp app = getAppInstance(InstrumentationRegistry.getContext());

    // Configure Firestore and disable persistence
    FirebaseFirestore.getInstance(app)
            .setFirestoreSettings(new FirebaseFirestoreSettings.Builder()
                    .setPersistenceEnabled(false)
                    .build());

    // Get a fresh 'test' subcollection for each test
    mCollectionRef = FirebaseFirestore.getInstance(app).collection("firestorearray")
            .document().collection("test");

    Log.d(TAG, "Test Collection: " + getConsoleLink(mCollectionRef));

    // Query is the whole collection ordered by field
    mArray = new FirestoreArray<>(
            mCollectionRef.orderBy("field", Query.Direction.ASCENDING),
            new ClassSnapshotParser<>(IntegerDocument.class));

    // Add a listener to the array so that it's active
    mListener = mArray.addChangeEventListener(new LoggingListener());

    // Add some initial data
    runAndVerify(new Callable<Task<?>>() {
        @Override
        public Task<?> call() {
            List<Task> tasks = new ArrayList<>();
            for (int i = 0; i < INITIAL_SIZE; i++) {
                tasks.add(mCollectionRef.document().set(new IntegerDocument(i)));
            }

            return Tasks.whenAll(tasks.toArray(new Task[tasks.size()]));
        }
    }, new Callable<Boolean>() {
        @Override
        public Boolean call() {
            return mArray.size() == INITIAL_SIZE;
        }
    });
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:43,代码来源:FirestoreArrayTest.java


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