-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TestSuite][Android][Database] Calls to setPersistenceEnabled() must be made before any other usage of FirebaseDatabase instance #97
Comments
I'll close mine in favour of this one as it contains more information. |
Appologies, @Ehesp - I didn't see your earlier issue at the time of posting. :/ Right you are, @Salakar. With fresh eyes, the error is indeed appearing in the Android logs because it is being caught and logged.
|
Seems like a few people have faced the same issue on android: http://stackoverflow.com/questions/37448186/setpersistenceenabledtrue-crashes-app Something like the second answer would work probably, or we could just remove the log of the catch, was only there to catch this issue really. |
I've removed the logging of |
I suspect this one may be a "won't fix", but I thought I'd document it nonetheless.
When running any of the database tests in the test suite app after having refreshed the app, the following error is raised in the Android logs:
I believe this is because
setPersistenceEnabled()
is being called each time the database is accessed for the first time after the app is refreshed. This exception is not thrown the first time the app is opened and the database tests are run - only after a refresh, does it occur.It seems refreshing clears the state of the JS (so the boolean flag maintained there for whether firebase has persistence enabled already) is cleared, however the firebase database (whatever singleton is returned by
mFirebaseAuth = FirebaseAuth.getInstance();
) is not cleared. So the JS thinks it's setting persistence for the first time, but it's not.I've tried moving this flag into the Java code, but this too, seems to be reset when the test app is refreshed.
Unfortunately, there is no documented way to query the FirebaseDatabase instance directly, to inspect it's persistence state, that I could find.
I am not sure if this is some side effect of the way the test application is wired to
react-native-firebase
and whether normal consumers of the library are also seeing this error while they develop their applications.This issue also does not appear to be causing any change in behaviour - just the exception being thrown - but it would be good to resolve this issue if anyone can come up with a solution.
The text was updated successfully, but these errors were encountered: