firebase Firebase Offline Capabilities Enable disk persistence (Android / iOS only)


Example

To enable disk persistence you should enable the flag persistenceEnabled in the FirebaseDatabaseInstance object of your application:

Android

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

iOS

Database.database().isPersistenceEnabled = true //Swift
[FIRDatabase database].persistenceEnabled = YES; //Objetive-C

If you want to disable the persistence in some moment of your app lifecycle you should remember to disable it in the same way:

Android

FirebaseDatabase.getInstance().setPersistenceEnabled(false);

iOS

Database.database().isPersistenceEnabled = false //Swift
[FIRDatabase database].persistenceEnabled = NO; //Objetive-C