I'm doing an android application with firebase, but I want to add the option to work offline, I read it with
but I do not know how to implement it since I'm getting the following error:
E / AndroidRuntime: FATAL EXCEPTION: main Process: com.example.gabo.company, PID: 20190 com.google.firebase.database.DatabaseException: Calls to setPersistenceEnabled () must be made before any other usage of FirebaseDatabase instance. at com.google.firebase.database.FirebaseDatabase.zzsc (Unknown Source) at com.google.firebase.database.FirebaseDatabase.setPersistence Enabled (Unknown Source) at com.example.gabo.empresa.Vistas.Vista1 $ 6.onClick (Vista1.java: 335)
Will someone have an example of how that is done?