Seré lo mas especifico.
Mi aplicacion empieza con una splash_screen donde se conecta a firebase y verifica un valor. Luego pasa a mainActivity y se finaliza (finish).
Dentro de la splash_screen defino FirebaseDatabase.getInstance().setPersistenceEnabled(true)
para tener los datos offline.
La aplicacion funciona bien salvo cuando pasa a segundo plano. Al volver a la misma, queda unos segundos la pantalla en blanco y se cierra repentinamente. No pone ningun tipo de error. En crashlytics aparece este error:
ERROR:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.guiacampings/com.app.guiacampings.Splash_Screen_Activity}: com.google.firebase.database.DatabaseException: Calls to setPersistenceEnabled() must be made before any other usage of FirebaseDatabase instance.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3556)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7948)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
alguien puede decirme donde puede estar el problema? En mainActivity vuelvo a usar firebase database.