A Firebase reference represents a particular location in your Database and can be used for reading or writing data to that Database location.
This class is the starting point for all Database operations. After you've initialized it with a URL, you can use it to read data, write data, and to create new DatabaseReferences.
| interface | DatabaseReference.CompletionListener | This interface is used as a method of being notified when an operation has been acknowledged by the Database servers and can be considered complete | |
| DatabaseReference | |
| boolean | |
| FirebaseDatabase |
getDatabase()
Gets the Database instance associated with this reference.
|
| String |
getKey()
|
| DatabaseReference | |
| DatabaseReference |
getRoot()
|
| static void |
goOffline()
Manually disconnect the Firebase Database client from the server and disable automatic
reconnection.
|
| static void |
goOnline()
Manually reestablish a connection to the Firebase Database server and enable automatic
reconnection.
|
| int |
hashCode()
|
| OnDisconnect |
onDisconnect()
Provides access to disconnect operations at this location
|
| DatabaseReference |
push()
Create a reference to an auto-generated child location.
|
| Task<Void> |
removeValue()
Set the value at this location to 'null'
|
| void | |
| void |
runTransaction(Transaction.Handler handler, boolean fireLocalEvents)
Run a transaction on the data at this location.
|
| void | |
| void |
setPriority(Object priority, DatabaseReference.CompletionListener listener)
Set a priority for the data at this Database location.
|
| Task<Void> | |
| void |
setValue(Object value, Object priority, DatabaseReference.CompletionListener listener)
Set the data and priority to the given values.
|
| void |
setValue(Object value, DatabaseReference.CompletionListener listener)
Set the data at this location to the given value.
|
| Task<Void> | |
| Task<Void> | |
| String |
toString()
|
| Task<Void> | |
| void |
updateChildren(Map<String, Object> update, DatabaseReference.CompletionListener listener)
Update the specific child keys to the specified values.
|
Get a reference to location relative to this one
| pathString | The relative path from this reference to the new one that should be created |
|---|
Gets the Database instance associated with this reference.
Manually disconnect the Firebase Database client from the server and disable automatic reconnection.
Note: Invoking this method will impact all Firebase Database connections.
Manually reestablish a connection to the Firebase Database server and enable automatic reconnection.
Note: Invoking this method will impact all Firebase Database connections.
Provides access to disconnect operations at this location
Create a reference to an auto-generated child location. The child key is generated client-side and incorporates an estimate of the server's time for sorting purposes. Locations generated on a single client will be sorted in the order that they are created, and will be sorted approximately in order across all clients.
Set the value at this location to 'null'
Task for this operation.
Set the value at this location to 'null'
| listener | A listener that will be triggered when the operation is complete |
|---|
Run a transaction on the data at this location. For more information on running transactions,
see Transaction.Handler.
| handler | An object to handle running the transaction |
|---|---|
| fireLocalEvents | Defaults to true. If set to false, events will only be fired for the final result state of the transaction, and not for any intermediate states |
Run a transaction on the data at this location. For more information on running transactions,
see Transaction.Handler.
| handler | An object to handle running the transaction |
|---|
Set a priority for the data at this Database location. Priorities can be used to provide a
custom ordering for the children at a location (if no priorities are specified, the children
are ordered by key).
You cannot set a priority on an empty location. For this reason setValue(data, priority) should
be used when setting initial data with a specific priority and setPriority should be used when
updating the priority of existing data.
Children are sorted based on this priority using the following rules:
| priority | The priority to set at the specified location or null to clear the existing priority |
|---|---|
| listener | A listener that will be triggered with results of the operation |
Set a priority for the data at this Database location. Priorities can be used to provide a
custom ordering for the children at a location (if no priorities are specified, the children
are ordered by key).
You cannot set a priority on an empty location. For this reason setValue(data, priority) should
be used when setting initial data with a specific priority and setPriority should be used when
updating the priority of existing data.
Children are sorted based on this priority using the following rules:
| priority | The priority to set at the specified location or null to clear the existing priority |
|---|
Task for this operation.
Set the data and priority to the given values. The native types accepted by this method for the value correspond to the JSON types:
Map<String, MyPOJO>, as well as null values.| value | The value to set at this location or null to delete the existing data |
|---|---|
| priority | The priority to set at this location or null to clear the existing priority |
| listener | A listener that will be triggered with the results of the operation |
Set the data at this location to the given value. Passing null to setValue() will delete the data at the specified location. The native types accepted by this method for the value correspond to the JSON types:
Map<String, MyPOJO>, as well as null values.| value | The value to set at this location or null to delete the existing data |
|---|---|
| listener | A listener that will be triggered with the results of the operation |
Set the data and priority to the given values. Passing null to setValue() will delete the data at the specified location. The native types accepted by this method for the value correspond to the JSON types:
Map<String, MyPOJO>, as well as null values.| value | The value to set at this location or null to delete the existing data |
|---|---|
| priority | The priority to set at this location or null to clear the existing priority |
Task for this operation.
Set the data at this location to the given value. Passing null to setValue() will delete the data at the specified location. The native types accepted by this method for the value correspond to the JSON types:
Map<String, MyPOJO>, as well as null values.| value | The value to set at this location or null to delete the existing data |
|---|
Task for this operation.
Update the specific child keys to the specified values. Passing null in a map to updateChildren() will remove the value at the specified location.
| update | The paths to update and their new values |
|---|
Task for this operation.
Update the specific child keys to the specified values. Passing null in a map to updateChildren() will remove the value at the specified location.
| update | The paths to update and their new values |
|---|---|
| listener | A listener that will be triggered with results of the operation |