Closed broersma closed 5 years ago
You should wait for FirebaseApp.CheckAndFixDependenciesAsync to successfully finish before calling any other Firebase methods. In most cases it will finish very quickly. In many cases, calling other Firebase functions while CheckAndFixDependenciesAsync is still running will throw an exception.
You can cause CheckAndFixDependenciesAsync to take a long time by reverting the Google Play services app (on Android) to the factory installed version. This will cause CheckAndFixDependenciesAsync to prompt you to update Google Play services, and it won't complete until the update is finished.
Some of the quickstarts do define a "firebaseInitialized" that is used by our internal tests, but the interactive quickstarts don't read that field. You should still make sure not to call Firebase functions before CheckAndFixDependenciesAsync finishes, though.
You can cause CheckAndFixDependenciesAsync to take a long time by reverting the Google Play services app (on Android) to the factory installed version. This will cause CheckAndFixDependenciesAsync to prompt you to update Google Play services, and it won't complete until the update is finished.
Thanks, that sounds quite useful! However, when I do this (on ancient (?) Android 6.0.1), it downgrades Google Play Services from 15.0.90 to 9.8.79, but when I run my app it seems like CheckAndFixDependenciesAsync
thinks everything is ok (while I do get notifications from Google Maps complaining about Google Play Services being outdated). Should 9.8.79 be good enough for Firebase?
Regardless, it seems the usage pattern here is to call CheckAndFixDependenciesAsync
during loading screen from a DontDestroyOnLoaded gameobject, while keeping guard clauses with firebaseInitialized
(or similar) around any calls to the actual Firebase functions. In this way, users without connectivity or a without a desire to update Google Play Service could still keep on using the app (even though Firebase might not function). Did I overlook anything?
but when I run my app it seems like
CheckAndFixDependenciesAsync
thinks everything is ok
Hmm, curiously, I even get this behaviour when I disable Google Play Services. So, while Google Maps complains about Google Play Services being disabled, CheckAndFixDependenciesAsync
seems to return with Firebase.DependencyStatus.Available
and I can see my app casually logging analytics events to the Firebase console's DebugView.
@broersma it depends upon the Firebase SDK version you're using since each SDK is a client to Google Play Services at a particular version and above. So if you're using a really old SDK then it's possible Firebase is happy while other parts of the system are not.
In your case, it depends upon the modules you're using. Some components of Firebase do not require Google Play Services see https://firebase.google.com/docs/cpp/setup#requiring_google_play_services
Please fill in the following fields:
Unity editor version: 2018.2.17f1 Firebase Unity SDK version: 5.4.4 Additional SDKs you are using (Facebook, AdMob, etc.): Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows Platform you are targeting (iOS, Android, and/or desktop): iOS, Android
Please describe the issue here:
Several testapps in this repository define a
firebaseInitialized
field in theUIHandler
MonoBehaviour (https://github.com/firebase/quickstart-unity/search?q=firebaseInitialized&unscoped_q=firebaseInitialized). Presumably this is the "flag here to indicate whether Firebase is ready to use by your app" you should set afterFirebaseApp.CheckAndFixDependenciesAsync
results inDependencyStatus.Available
as per https://firebase.google.com/docs/unity/setup#confirm_google_play_version.This
firebaseInitialized
field however seems to be unread in the code in the samples. So why is it there in the first place?Now, I have tried searching far and wide but nowhere I can find anything more definitive than a vague warning that "Firebase Unity SDK is not safe to use" if
FirebaseApp.CheckAndFixDependenciesAsync
isn't called or doesn't result inDependencyStatus.Available
.So, what bad stuff will actually happen if the dependencies cannot or aren't succesfully checked and fixed?
FirebaseAnalytics.LogEvent
?if (firebaseInitialized)
? (Or is that not really necessary, like in the samples in this repo?)Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes, trivially. :-)