Home > database >  Can I have Firebase database disk persistence enabled for selective children and for other not?
Can I have Firebase database disk persistence enabled for selective children and for other not?

Time:03-03

I want to save space for offline usage. Now in my start class, I include this line:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

I do not know how to implement it for one child only for example and the others be available only online.

CodePudding user response:

When using the following line of code in your project:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

It means that all data from the Realtime Database that the user recently received is cached to the disk.

I do not know how to implement it for one child only for example and the others be available only online.

There is no way you can exclude certain nodes from that disk persistence. So you cannot choose whether a node should be or shouldn't be cached on the disk. It's all or nothing.

  • Related