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 Method Summary
FirebaseApp |
getApp()
Returns the FirebaseApp instance to which this FirebaseDatabase belongs.
|
static FirebaseDatabase | |
static FirebaseDatabase |
getInstance()
Gets the default FirebaseDatabase instance.
|
static FirebaseDatabase | |
synchronized static FirebaseDatabase |
getInstance(FirebaseApp
app, String
url)
Gets a FirebaseDatabase instance for the specified URL, using the specified
FirebaseApp.
|
DatabaseReference |
getReference()
Gets a DatabaseReference for the database root node.
|
DatabaseReference | |
DatabaseReference | |
static String | |
void |
goOffline()
Shuts down our connection to the Firebase Database backend until
goOnline() is called.
|
void |
goOnline()
Resumes our connection to the Firebase Database backend after a previous
goOffline() call.
|
void |
purgeOutstandingWrites()
The Firebase Database client automatically queues writes and sends them to the
server at the earliest opportunity, depending on network connectivity.
|
synchronized void | |
synchronized void |
setPersistenceCacheSizeBytes(long cacheSizeInBytes)
By default Firebase Database will use up to 10MB of disk space to cache data.
|
synchronized void |
setPersistenceEnabled(boolean isEnabled)
The Firebase Database client will cache synchronized data and keep track of all
writes you've initiated while your application is running.
|
Inherited Method Summary
Public Methods
public FirebaseApp getApp ()
Returns the FirebaseApp instance to which this FirebaseDatabase belongs.
Returns
- The FirebaseApp instance to which this FirebaseDatabase belongs.
public static FirebaseDatabase getInstance (String url)
Gets a FirebaseDatabase instance for the specified URL.
Parameters
url | The URL to the Firebase Database instance you want to access. |
---|
Returns
- A FirebaseDatabase instance.
public static FirebaseDatabase getInstance ()
Gets the default FirebaseDatabase instance.
Returns
- A FirebaseDatabase instance.
public static FirebaseDatabase getInstance (FirebaseApp app)
Gets an instance of FirebaseDatabase for a specific FirebaseApp.
Parameters
app | The FirebaseApp to get a FirebaseDatabase for. |
---|
Returns
- A FirebaseDatabase instance.
public static synchronized FirebaseDatabase getInstance (FirebaseApp app, String url)
Gets a FirebaseDatabase instance for the specified URL, using the specified FirebaseApp.
Parameters
app | The FirebaseApp to get a FirebaseDatabase for. |
---|---|
url | The URL to the Firebase Database instance you want to access. |
Returns
- A FirebaseDatabase instance.
public DatabaseReference getReference ()
Gets a DatabaseReference for the database root node.
Returns
- A DatabaseReference pointing to the root node.
public DatabaseReference getReference (String path)
Gets a DatabaseReference for the provided path.
Parameters
path | Path to a location in your FirebaseDatabase. |
---|
Returns
- A DatabaseReference pointing to the specified path.
public DatabaseReference getReferenceFromUrl (String url)
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.
Parameters
url | A URL to a path within your database. |
---|
Returns
- A DatabaseReference for the provided URL.