SnapshotListenOptions

public final class SnapshotListenOptions


An options object that configures the behavior of addSnapshotListener() calls. Instances of this class control settings such as whether metadata-only changes trigger events, the preferred data source (server or cache), and the executor for listener callbacks.

Summary

Nested types

Builder for constructing SnapshotListenOptions instances.

Public fields

final Activity

The activity to scope the listener to.

final Executor

The executor to use to call the listener.

final MetadataChanges

Indicates whether metadata-only changes should trigger snapshot events.

final ListenSource

Specifies the data source for the listener.

Public methods

boolean
@Nullable Activity

Returns the optional Activity that scopes this snapshot listener's lifespan.

@NonNull Executor

Returns the executor that will be used to execute the snapshot listener's callback.

@NonNull MetadataChanges

Returns the setting for whether metadata-only changes should trigger snapshot events.

@NonNull ListenSource

Returns the preferred source for retrieving data in snapshot listeners.

int
String

Public fields

activity

public final Activity activity

The activity to scope the listener to.

executor

public final Executor executor

The executor to use to call the listener.

metadataChanges

public final MetadataChanges metadataChanges

Indicates whether metadata-only changes should trigger snapshot events.

source

public final ListenSource source

Specifies the data source for the listener.

Public methods

equals

public boolean equals(Object o)

getActivity

public @Nullable Activity getActivity()

Returns the optional Activity that scopes this snapshot listener's lifespan. If provided, the listener will automatically stop receiving events when the activity is destroyed.

Returns
@Nullable Activity

The Activity associated with this listener, or null if no activity is set.

getExecutor

public @NonNull Executor getExecutor()

Returns the executor that will be used to execute the snapshot listener's callback.

Returns
@NonNull Executor

The executor for snapshot listener callbacks.

getMetadataChanges

public @NonNull MetadataChanges getMetadataChanges()

Returns the setting for whether metadata-only changes should trigger snapshot events.

Returns
@NonNull MetadataChanges

The setting object for metadata-only changes.

getSource

public @NonNull ListenSource getSource()

Returns the preferred source for retrieving data in snapshot listeners.

Returns
@NonNull ListenSource

The listen source for retrieving data.

hashCode

public int hashCode()

toString

public String toString()