[BETA FEATURE] Disk Persistence on Android

547 views
Skip to first unread message

Jonny Dimond

unread,
Feb 12, 2015, 9:28:34 PM2/12/15
to fireba...@googlegroups.com

Hi Firebasers,


I’ve got another Firebase goodie to share with you today: our latest release of the Android client has beta support for disk persistence!


Providing offline support for mobile is one of our biggest priorities, and we’re looking forward to getting your feedback. With local disk persistence, your app will work much better offline.  Even after an application restart, all of your previously downloaded data will be available.  Any writes you made while offline will be synchronized back to Firebase when you reconnect.


To enable offline support in your Android app:


  1. Make sure to include the latest Firebase SDK (2.2.0) in your project

  2. Before creating your first Firebase reference, call

    Firebase.getDefaultConfig().enablePersistence();

A beta version of disk persistence on iOS is already available, and you can find instructions for enabling it here. JavaScript offline support is coming soon, stay tuned :)


We’re planning to add some extended functionality to this in the future, and I’d love to get your feedback on offline support as you try it out. Please email me (jo...@firebase.com) with any issues you encounter.


Thanks!

Jonny

Galileo June Destura

unread,
Feb 13, 2015, 10:03:30 AM2/13/15
to fireba...@googlegroups.com
Hi Jonny,

Thanks for the announcement.  IS the Firebase.getDefaultConfig().enabePersistence() call before or after Firebase.initialize(this) call? 

Thanks!

Gal

Jonny Dimond

unread,
Feb 13, 2015, 1:16:27 PM2/13/15
to fireba...@googlegroups.com
Hi Gal,

the order doesn't matter, but I would advise to make the call at the same time.

Jonny

Steffen Mayer

unread,
Mar 12, 2015, 12:35:36 PM3/12/15
to fireba...@googlegroups.com
Hi Jonny,

Thanks for your post about Disk Persistence on Android. I'm working on a weight tracking app which has to work fully offline even if the app restarted. Enabling Persistence does exactly what I needed.

But as I wanted to release my app within the next few weeks I wonder how 'beta' the feature currently (2.2.1) is. Can I already use it in production or do you recommend to wait and if so what timeframe can I expect until a more stable version?

Best regards,
Steffen

Jonny Dimond

unread,
Mar 12, 2015, 1:01:27 PM3/12/15
to fireba...@googlegroups.com
Hi Steffen,

thanks for asking about disk persistence. In this context "beta" means that this feature is new (on Android) and has not been battle tested yet (in contrast to running tests ourselves, which we of course did). We are not aware of any bugs at this time and you can use it in production, but make sure to test extra carefully before you do.

Jonny

Sher Hurlburt

unread,
Mar 14, 2015, 12:00:50 PM3/14/15
to fireba...@googlegroups.com
This is exciting and certainly demanded by users; however, since Firebase intends to synch the user to server, isn't there a concern that users (who do not have unlimited data) will find themselves with unexpected charges?

Kato Richardson

unread,
Mar 14, 2015, 12:05:05 PM3/14/15
to fireba...@googlegroups.com
Sher,

Offline persistence utilizes local device storage. When the connection is restored, that data is synchronized in the same manner as it would be any other time the device is online. There's no real difference in bandwidth or usage here than one would normally experience with Firebase.

Cheers,
Kato


On Fri, Mar 13, 2015 at 5:51 PM, Sher Hurlburt <shurl...@gmail.com> wrote:
This is exciting and certainly demanded by users; however, since Firebase intends to synch the user to server, isn't there a concern that users (who do not have unlimited data) will find themselves with unexpected charges?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/b854db45-59f1-420f-b292-69ed04cf2d11%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Steffen Mayer

unread,
Mar 19, 2015, 9:47:56 AM3/19/15
to fireba...@googlegroups.com
Hi,

While testing the reliability of Disk Persistence on Android I experienced a few limitations.

With airplane mode enabled and the app restarted (force closed) once after each new object added and value updated:
  1. I can only push up to 30 new objects after that the oldest disappear.
  2. I can only update an existing object 1-5 times (randomly varying). Then after an app restart the object value always resets to the last successfully updated value.
I experienced this with my own test app and also the Firebase AndroidChat example with "Firebase.getDefaultConfig().enablePersistence();" added to it's application class.

Are these general limitations of the Disk Persistence cache or might there be another problem?

Best regards,
Steffen

Jonny Dimond

unread,
Mar 19, 2015, 5:01:55 PM3/19/15
to fireba...@googlegroups.com
Quick update: We're working on a fix for the issue Steffen reported.

Jonny Dimond

unread,
Mar 20, 2015, 4:46:12 PM3/20/15
to fireba...@googlegroups.com
We just released version 2.2.3 of the Android client library. This should fix the issues Steffen was seeing. Thanks for reporting this Steffen!

Valerio Moro

unread,
Apr 19, 2015, 8:40:29 PM4/19/15
to fireba...@googlegroups.com
Hello everybody!

Very interesting feature!
Does it work already with Javascript?
I am using Ionic framework

Thanks 

Valerio

Michael Lehenbauer

unread,
Apr 20, 2015, 11:27:25 AM4/20/15
to fireba...@googlegroups.com
Hey Valerio, thanks for reaching out!

Unfortunately, we don't have it for JavaScript yet.  I've added you to the waiting list though so we'll reach out when it's available.

Best regards,
-Michael

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

Valerio Moro

unread,
Apr 29, 2015, 3:06:47 PM4/29/15
to fireba...@googlegroups.com
Thanks a lot!
I am looking forward to it!

vinayak bhavnani

unread,
May 26, 2015, 9:26:32 AM5/26/15
to fireba...@googlegroups.com
Hi Guys, havn't tried it out yet but I very much need this feature.

Have few queries around this, what's the size of the disk cache being used here?
Also, can we modify the caching policy. I have a use case wherein I don't want to evict certain piece of data.

It would be best to hear more about the implementation and customisations possible. I am using the Android version.

Jonny Dimond

unread,
May 26, 2015, 12:20:03 PM5/26/15
to fireba...@googlegroups.com
Hi Vinayak,

we're working on releasing a new version that will let you set the cache size soon. We currently do not let you set the cache policy, but we will not evict recently used data. So if you want to make sure that data is never evicted you can attach a listener when your app starts...

Jonny

vinayak bhavnani

unread,
May 28, 2015, 12:45:13 AM5/28/15
to fireba...@googlegroups.com
Thanks Jonny for the prompt response.
I will try it out and give my feedback.

Do you have any estimated date for the new version?

Vinayak
Reply all
Reply to author
Forward
0 new messages