Firebase component & "Persist" property

We had received a lot of crash’s because some users (about 700) did not follow the throwed runtime description.

Caused by java.lang.RuntimeException
You cannot change the Persist value of Firebase after Application Initialization, this includes the Companion

Here is the “Persist” block description:

If true, variables will retain their values when off-line and the App exits. Values will be uploaded to Firebase the next time the App is
run while connected to the network. This is useful for applications which will gather data while not connected to the network.
Note: AppendValue and RemoveFirst will not work correctly when off-line, they require a network connection.
Note: If you set Persist on any Firebase component, on any screen, it makes all Firebase components on all screens persistent.
This is a limitation of the low level Firebase library. Also be aware that if you want to set persist to true,
you should do so before connecting the Companion for incremental development.

1

Solution for the problem
Read the content of the error message:

You cannot change the Persist value of Firebase after Application Initialization, this includes the Companion

4 Likes