My Ionic 3 app uses Firebase, which is initialized in app.component.ts, and also Geofire (which relies on Firebase), which is initialized in a provider. I noticed that sometimes when I launch the app, the Geofire provider runs first (before app.component), causing an error because Firebase isn’t initialized yet. I even wrapped the GeoFire initialization in
…, and wrapped the firebase initialization in
platform.ready().then() in app.component, but it still runs before the initialization in app.component.
I thought everything in app.component always runs first before any providers and such, when the app is launched. How can I force the provider to run only after Firebase is fully initialized in app.component.ts? Or is there a way to detect from the provider whether Firebase has been initialized?