It is given: Application working with firebase.
Problem: The application crashes when you first start if there is no Internet ( because it does not have time to cache the database from the Internet ). Let me explain in more detail the application is implemented so that when you first start an anonymous user is created in the database and if you turn off the Internet after that, the application works without problems, but if this is the first start and no Internet falls with an NPE error ( because user null, as so it is clear, no Internet can register anonymously )
Question: How can you implement support for offline mode when you first start the application and certainly the absence of the Internet
Additionally: I did everything as written in the guides.
FirebaseDatabase.getInstance().setPersistenceEnabled(true); DatabaseReference scoresRef = FirebaseDatabase.getInstance().getReference("scores"); scoresRef.keepSynced(true);