| java.lang.Object | |
| ↳ | com.google.firebase.database.FirebaseDatabase |
The entry point for accessing a Firebase Database. You can get an instance by calling
getInstance(). To access a location in the database and read or
write data, use getReference().
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the FirebaseApp instance to which this FirebaseDatabase belongs.
| |||||||||||
Gets the instance of FirebaseDatabase for the default FirebaseApp.
| |||||||||||
Gets an instance of FirebaseDatabase for a specific FirebaseApp.
| |||||||||||
Gets a DatabaseReference for the provided path.
| |||||||||||
Gets a DatabaseReference for the provided URL.
| |||||||||||
Shuts down our connection to the Firebase Database backend until
goOnline() is called. | |||||||||||
Resumes our connection to the Firebase Database backend after a previous
goOffline() call. | |||||||||||
The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity,
depending on network connectivity.
| |||||||||||
By default, this is set to
INFO. | |||||||||||
The Firebase Database client will cache synchronized data and keep track of all writes you've
initiated while your application is running.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Returns the FirebaseApp instance to which this FirebaseDatabase belongs.
Gets the instance of FirebaseDatabase for the default FirebaseApp.
Gets an instance of FirebaseDatabase for a specific FirebaseApp.
| app | The FirebaseApp to get a FirebaseDatabase for. |
|---|
Gets a DatabaseReference for the provided path.
| path | Path to a location in your FirebaseDatabase. |
|---|
Gets a DatabaseReference for the provided URL. The URL must be a URL to a path
within this FirebaseDatabase. To create a DatabaseReference to a different database,
create a FirebaseApp with a FirebaseOptions object configured with
the appropriate database URL.
| url | A URL to a path within your database. |
|---|
Shuts down our connection to the Firebase Database backend until goOnline() is called.
Resumes our connection to the Firebase Database backend after a previous goOffline() call.
The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity,
depending on network connectivity. In some cases (e.g. offline usage) there may be a large number of writes
waiting to be sent. Calling this method will purge all outstanding writes so they are abandoned.
All writes will be purged, including transactions and onDisconnect() writes. The writes will
be rolled back locally, perhaps triggering events for affected event listeners, and the client will not
(re-)send them to the Firebase backend.
The Firebase Database client will cache synchronized data and keep track of all writes you've initiated while your application is running. It seamlessly handles intermittent network connections and re-sends write operations when the network connection is restored. However by default your write operations and cached data are only stored in-memory and will be lost when your app restarts. By setting this value to `true`, the data will be persisted to on-device (disk) storage and will thus be available again when the app is restarted (even when there is no network connectivity at that time). Note that this method must be called before creating your first Database reference and only needs to be called once per application.
| isEnabled | Set to true to enable disk persistence, set to false to disable it. |
|---|