FirebaseFirestoreSettings.Builder

public final class FirebaseFirestoreSettings.Builder


A Builder for creating FirebaseFirestoreSettings.

Summary

Public fields

long
String

Public constructors

Constructs a new FirebaseFirestoreSettings Builder object.

Constructs a new FirebaseFirestoreSettings Builder based on an existing FirebaseFirestoreSettings object.

Public methods

@NonNull FirebaseFirestoreSettings
long

This method is deprecated.

Instead, build the FirebaseFirestoreSettings instance to check the SDK cache configurations.

@NonNull String
boolean

This method is deprecated.

Instead, build the FirebaseFirestoreSettings instance to check the SDK cache configurations.

boolean
@NonNull FirebaseFirestoreSettings.Builder
setCacheSizeBytes(long value)

This method is deprecated.

Instead, use setLocalCacheSettings to configure SDK cache.

@NonNull FirebaseFirestoreSettings.Builder

Sets the host of the Cloud Firestore backend.

@NonNull FirebaseFirestoreSettings.Builder

Specifies the cache used by the SDK.

@NonNull FirebaseFirestoreSettings.Builder
setPersistenceEnabled(boolean value)

This method is deprecated.

Instead, use setLocalCacheSettings to configure SDK cache.

@NonNull FirebaseFirestoreSettings.Builder
setSslEnabled(boolean value)

Enables or disables SSL for communication.

Public fields

cacheSizeBytes

public long cacheSizeBytes

host

public String host

Public constructors

Builder

public Builder()

Constructs a new FirebaseFirestoreSettings Builder object.

Builder

public Builder(@NonNull FirebaseFirestoreSettings settings)

Constructs a new FirebaseFirestoreSettings Builder based on an existing FirebaseFirestoreSettings object.

Public methods

getCacheSizeBytes

public long getCacheSizeBytes()
Returns
long

cache size for on-disk data.

getHost

public @NonNull String getHost()
Returns
@NonNull String

the host of the Cloud Firestore backend.

isPersistenceEnabled

public boolean isPersistenceEnabled()
Returns
boolean

boolean indicating whether local persistent storage is enabled or not.

isSslEnabled

public boolean isSslEnabled()
Returns
boolean

boolean indicating whether SSL is enabled or not.

setCacheSizeBytes

public @NonNull FirebaseFirestoreSettings.Builder setCacheSizeBytes(long value)

Sets an approximate cache size threshold for the on-disk data. If the cache grows beyond this size, Cloud Firestore will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.

By default, collection is enabled with a cache size of 100 MB. The minimum value is 1 MB.

Returns
@NonNull FirebaseFirestoreSettings.Builder

A settings object on which the cache size is configured as specified by the given value.

setHost

public @NonNull FirebaseFirestoreSettings.Builder setHost(@NonNull String host)

Sets the host of the Cloud Firestore backend.

Parameters
@NonNull String host

The host string

Returns
@NonNull FirebaseFirestoreSettings.Builder

A settings object with the host set.

setLocalCacheSettings

public @NonNull FirebaseFirestoreSettings.Builder setLocalCacheSettings(@NonNull LocalCacheSettings settings)

Specifies the cache used by the SDK. Available options are PersistentCacheSettings and MemoryCacheSettings, each with different configuration options.

When unspecified, PersistentCacheSettings will be used by default.

NOTE: Calling this setter and setPersistenceEnabled() or setCacheSizeBytes() at the same time will throw an exception during SDK initialization. Instead, use the configuration in the PersistentCacheSettings object to specify the cache size.

Returns
@NonNull FirebaseFirestoreSettings.Builder

A settings object on which the cache settings is configured as specified by the given settings.

setPersistenceEnabled

public @NonNull FirebaseFirestoreSettings.Builder setPersistenceEnabled(boolean value)

Enables or disables local persistent storage. The default is to use local persistent storage.

Returns
@NonNull FirebaseFirestoreSettings.Builder

A settings object that uses local persistent storage as specified by the given value.

setSslEnabled

public @NonNull FirebaseFirestoreSettings.Builder setSslEnabled(boolean value)

Enables or disables SSL for communication. The default is to use SSL.

Returns
@NonNull FirebaseFirestoreSettings.Builder

A settings object that uses SSL as specified by the value.