View local firebase database with Stheto on Android
up vote
0
down vote
favorite
I'm currently building an Android app which uses Firebases realtime database as it's backend. I observed, that getting the children of a node the first time takes longer so I assume, that Firebase uses a local database. However the local files seem to be deleted if the app is killed (even with persistence enabled).
I wanted to inspect the local database using Stetho, but I can't find the data in the local databases displayed in chromes developer tools.
Is there a way to view how the local database looks like? And is there a possibility to keep the data even if the app is killed?
add a comment |
up vote
0
down vote
favorite
I'm currently building an Android app which uses Firebases realtime database as it's backend. I observed, that getting the children of a node the first time takes longer so I assume, that Firebase uses a local database. However the local files seem to be deleted if the app is killed (even with persistence enabled).
I wanted to inspect the local database using Stetho, but I can't find the data in the local databases displayed in chromes developer tools.
Is there a way to view how the local database looks like? And is there a possibility to keep the data even if the app is killed?
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm currently building an Android app which uses Firebases realtime database as it's backend. I observed, that getting the children of a node the first time takes longer so I assume, that Firebase uses a local database. However the local files seem to be deleted if the app is killed (even with persistence enabled).
I wanted to inspect the local database using Stetho, but I can't find the data in the local databases displayed in chromes developer tools.
Is there a way to view how the local database looks like? And is there a possibility to keep the data even if the app is killed?
I'm currently building an Android app which uses Firebases realtime database as it's backend. I observed, that getting the children of a node the first time takes longer so I assume, that Firebase uses a local database. However the local files seem to be deleted if the app is killed (even with persistence enabled).
I wanted to inspect the local database using Stetho, but I can't find the data in the local databases displayed in chromes developer tools.
Is there a way to view how the local database looks like? And is there a possibility to keep the data even if the app is killed?
asked Oct 20 '17 at 13:17
buellas
8419
8419
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
tl;dr: you likely haven't enabled disk persistence.
What happens on your first read from the database
When your app first connects to Firebase, this happens:
The first time you're retrieving data, Firebase sets up a connection between the client and the server. The time this takes depends on the path between the client and the server, but is usually multiple seconds.
If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.
Then Firebase retrieves the data that you requested. The time this takes is mostly dependent on the amount of data you request and the bandwidth of the client device.
If these steps, step 3 often takes the least amount of time. Yet when you request additional data the Firebase client only has to take step 3, since it maintains its connection and authentication state between calls.
Where Firebase caches data
By default Firebase keeps the data that you're actively listening for in memory. If you attach a second listener for the same data, that listener gets a copy of the data from memory. So the read is instant in that case, since even step 3 from before isn't needed.
When you detach all listener for a specific piece of data, Firebase will flush it from memory immediately. So that means that next time you attach a listener, it will have to re-read the data (step 3 from above).
If you enable disk persistence, the Firebase client will also store a copy of any data it receives to disk. This is a so-called MRU cache, so it only contains recent data, and it persists between restarts of your app. But this only happens if you've enabled persistence.
Where the local disk cache lives
The local disk cache is a regular sqlite database. If you're interested in looking at it for debugging purposes, it (for me at least) lives in /data/data/{applicationId}/{applicationId}_default. It is a sqlite database. But the format is not documented, so you're on your own figuring out anything inside it.
Also see:
- How firebase persistence stores local data for my Android app
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
tl;dr: you likely haven't enabled disk persistence.
What happens on your first read from the database
When your app first connects to Firebase, this happens:
The first time you're retrieving data, Firebase sets up a connection between the client and the server. The time this takes depends on the path between the client and the server, but is usually multiple seconds.
If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.
Then Firebase retrieves the data that you requested. The time this takes is mostly dependent on the amount of data you request and the bandwidth of the client device.
If these steps, step 3 often takes the least amount of time. Yet when you request additional data the Firebase client only has to take step 3, since it maintains its connection and authentication state between calls.
Where Firebase caches data
By default Firebase keeps the data that you're actively listening for in memory. If you attach a second listener for the same data, that listener gets a copy of the data from memory. So the read is instant in that case, since even step 3 from before isn't needed.
When you detach all listener for a specific piece of data, Firebase will flush it from memory immediately. So that means that next time you attach a listener, it will have to re-read the data (step 3 from above).
If you enable disk persistence, the Firebase client will also store a copy of any data it receives to disk. This is a so-called MRU cache, so it only contains recent data, and it persists between restarts of your app. But this only happens if you've enabled persistence.
Where the local disk cache lives
The local disk cache is a regular sqlite database. If you're interested in looking at it for debugging purposes, it (for me at least) lives in /data/data/{applicationId}/{applicationId}_default. It is a sqlite database. But the format is not documented, so you're on your own figuring out anything inside it.
Also see:
- How firebase persistence stores local data for my Android app
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
add a comment |
up vote
0
down vote
accepted
tl;dr: you likely haven't enabled disk persistence.
What happens on your first read from the database
When your app first connects to Firebase, this happens:
The first time you're retrieving data, Firebase sets up a connection between the client and the server. The time this takes depends on the path between the client and the server, but is usually multiple seconds.
If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.
Then Firebase retrieves the data that you requested. The time this takes is mostly dependent on the amount of data you request and the bandwidth of the client device.
If these steps, step 3 often takes the least amount of time. Yet when you request additional data the Firebase client only has to take step 3, since it maintains its connection and authentication state between calls.
Where Firebase caches data
By default Firebase keeps the data that you're actively listening for in memory. If you attach a second listener for the same data, that listener gets a copy of the data from memory. So the read is instant in that case, since even step 3 from before isn't needed.
When you detach all listener for a specific piece of data, Firebase will flush it from memory immediately. So that means that next time you attach a listener, it will have to re-read the data (step 3 from above).
If you enable disk persistence, the Firebase client will also store a copy of any data it receives to disk. This is a so-called MRU cache, so it only contains recent data, and it persists between restarts of your app. But this only happens if you've enabled persistence.
Where the local disk cache lives
The local disk cache is a regular sqlite database. If you're interested in looking at it for debugging purposes, it (for me at least) lives in /data/data/{applicationId}/{applicationId}_default. It is a sqlite database. But the format is not documented, so you're on your own figuring out anything inside it.
Also see:
- How firebase persistence stores local data for my Android app
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
tl;dr: you likely haven't enabled disk persistence.
What happens on your first read from the database
When your app first connects to Firebase, this happens:
The first time you're retrieving data, Firebase sets up a connection between the client and the server. The time this takes depends on the path between the client and the server, but is usually multiple seconds.
If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.
Then Firebase retrieves the data that you requested. The time this takes is mostly dependent on the amount of data you request and the bandwidth of the client device.
If these steps, step 3 often takes the least amount of time. Yet when you request additional data the Firebase client only has to take step 3, since it maintains its connection and authentication state between calls.
Where Firebase caches data
By default Firebase keeps the data that you're actively listening for in memory. If you attach a second listener for the same data, that listener gets a copy of the data from memory. So the read is instant in that case, since even step 3 from before isn't needed.
When you detach all listener for a specific piece of data, Firebase will flush it from memory immediately. So that means that next time you attach a listener, it will have to re-read the data (step 3 from above).
If you enable disk persistence, the Firebase client will also store a copy of any data it receives to disk. This is a so-called MRU cache, so it only contains recent data, and it persists between restarts of your app. But this only happens if you've enabled persistence.
Where the local disk cache lives
The local disk cache is a regular sqlite database. If you're interested in looking at it for debugging purposes, it (for me at least) lives in /data/data/{applicationId}/{applicationId}_default. It is a sqlite database. But the format is not documented, so you're on your own figuring out anything inside it.
Also see:
- How firebase persistence stores local data for my Android app
tl;dr: you likely haven't enabled disk persistence.
What happens on your first read from the database
When your app first connects to Firebase, this happens:
The first time you're retrieving data, Firebase sets up a connection between the client and the server. The time this takes depends on the path between the client and the server, but is usually multiple seconds.
If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.
Then Firebase retrieves the data that you requested. The time this takes is mostly dependent on the amount of data you request and the bandwidth of the client device.
If these steps, step 3 often takes the least amount of time. Yet when you request additional data the Firebase client only has to take step 3, since it maintains its connection and authentication state between calls.
Where Firebase caches data
By default Firebase keeps the data that you're actively listening for in memory. If you attach a second listener for the same data, that listener gets a copy of the data from memory. So the read is instant in that case, since even step 3 from before isn't needed.
When you detach all listener for a specific piece of data, Firebase will flush it from memory immediately. So that means that next time you attach a listener, it will have to re-read the data (step 3 from above).
If you enable disk persistence, the Firebase client will also store a copy of any data it receives to disk. This is a so-called MRU cache, so it only contains recent data, and it persists between restarts of your app. But this only happens if you've enabled persistence.
Where the local disk cache lives
The local disk cache is a regular sqlite database. If you're interested in looking at it for debugging purposes, it (for me at least) lives in /data/data/{applicationId}/{applicationId}_default. It is a sqlite database. But the format is not documented, so you're on your own figuring out anything inside it.
Also see:
- How firebase persistence stores local data for my Android app
answered Oct 20 '17 at 13:53
Frank van Puffelen
219k25361387
219k25361387
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
add a comment |
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
the locl copy(when persistence is not enabled), is it indexable?
– Dr4ke the b4dass
Jun 26 at 1:21
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46849945%2fview-local-firebase-database-with-stheto-on-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown