com.google.firebase.database.DatabaseException: Calls to setPersistenceEnabled() must be made before any other usage of FirebaseDatabase instance

前端 未结 8 942
慢半拍i
慢半拍i 2020-11-29 05:15

I am having a problem when I try to setPersistence in fIREBASE,can someone please explain on how to go about it,

protected void onCreate(Bundle savedInstance         


        
8条回答
  •  独厮守ぢ
    2020-11-29 05:45

    Just add this at the top of your activity class:

    static {
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
    }
    

    Worked for me, not sure if it's the best practice though.

提交回复
热议问题