Do we get all the Firebase data as a cache after enabling standalone features in android?

I have doubts about the autonomous capabilities in Firebase android. After enabling the Firebase feature offline,

Are we getting all the data from our Firebase application, including root data or just logged in user data as a cache ?

final FirebaseDatabase database = FirebaseDatabase.getInstance();
        if (database != null) {
            database.setPersistenceEnabled(true);
            database.getReference().keepSynced(true);
        }

I use this piece of code to enable a standalone function in an application class

+6
source share
2 answers

Here I got an answer to my question from the Firebase Support Team

, , ( ) firebase , keepSynced() node .

, :

final FirebaseDatabase database = FirebaseDatabase.getInstance();
    if (database != null) {
        database.setPersistenceEnabled(true);
        database.getReference().keepSynced(true);
    }

, root node .

, , keepSynced(). , , .

keepSynced() databaseReferences, .

, setPersistenceEnabled() Application. .

, setPersistenceEnabled() , . .

setPersistanceEnabled() .

@Override
public void onCreate() {
  super.onCreate();
  if (!FirebaseApp.getApps(this).isEmpty()) {
    FirebaseDatabase.getInstance().setPersistenceEnabled(true);
  }
}
+3

, , Firebase , - , .

0

Source: https://habr.com/ru/post/1015983/


All Articles