firebase::database::ValueListener

This is an abstract class.

#include <listener.h>

Value listener interface.

Summary

Subclasses of this listener class can be used to receive events about data changes at a location. Attach the listener to a location usingDatabaseReference::AddValueListener() orQuery::AddValueListener(), andOnValueChanged() will be called once immediately, and again when the value changes.

Constructors and Destructors

~ValueListener()

Public functions

OnCancelled(constError & error, const char *error_message)=0
virtual void
This method will be triggered in the event that this listener either failed at the server, or is removed as a result of the security and Firebase rules.
OnValueChanged(constDataSnapshot & snapshot)=0
virtual void
This method will be called with a snapshot of the data at this location each time that data changes.

Public functions

OnCancelled

virtualvoidOnCancelled(constError&error,constchar*error_message)=0

This method will be triggered in the event that this listener either failed at the server, or is removed as a result of the security and Firebase rules.

Details
Parameters
error
A code corresponding to the error that occurred.
error_message
A description of the error that occurred.

OnValueChanged

virtualvoidOnValueChanged(constDataSnapshot&snapshot)=0

This method will be called with a snapshot of the data at this location each time that data changes.

Details
Parameters
snapshot
The current data at the location.

~ValueListener

virtual~ValueListener()

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.