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?










share|improve this question


























    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?










    share|improve this question
























      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?










      share|improve this question













      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?







      android firebase firebase-realtime-database stetho






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 20 '17 at 13:17









      buellas

      8419




      8419
























          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:




          1. 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.


          2. If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.


          3. 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






          share|improve this answer





















          • the locl copy(when persistence is not enabled), is it indexable?
            – Dr4ke the b4dass
            Jun 26 at 1:21











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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

























          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:




          1. 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.


          2. If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.


          3. 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






          share|improve this answer





















          • the locl copy(when persistence is not enabled), is it indexable?
            – Dr4ke the b4dass
            Jun 26 at 1:21















          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:




          1. 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.


          2. If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.


          3. 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






          share|improve this answer





















          • the locl copy(when persistence is not enabled), is it indexable?
            – Dr4ke the b4dass
            Jun 26 at 1:21













          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:




          1. 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.


          2. If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.


          3. 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






          share|improve this answer












          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:




          1. 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.


          2. If you use authentication, then this initial "handshake" also includes signing the user in, or refreshing their token.


          3. 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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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


















          • 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


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word