Hey guys, i want to use firebase as database for my mobile app, but i want to use firebase push notifications aswell.
So if i want to use the firebase push notifications i need to get angular fire and init the database settings in my app.module.ts and if i want to use the firebase ( for realtime database ) i need to init the firebase config in my app.component.ts .
So if i init the firebase settings in app.module.ts with angular fire it’s shows that i want to access firebase before the init ( that’s because i have services to firebase realtime database)
But if init my firebase in app.component.ts angular fire is not working.
If i init the firebase in app.component.ts and in app.module.ts it shows that i can’t have 2 configs to the same firebase database.
My question is how do i use firebase for push notifications and as realtime database .
Thanks.
bumb, no one knows anything?
It might help others to show some code
Okay, so if we are using angular fire we need to init Firebase in our app.module.ts like this 
imports: [
BrowserModule,
AngularFire(firebase.initializeAp(config))
IonicStorageModule.forRoot(),
IonicModule.forRoot(MyApp)
],
If i init firebase like this there is an error which says that i’m trying to use firebase before it is init.
If i init firebase in app.component.ts on platform.ready() it says taht angular fire is not initiliazed and i can’t use firebase push notification.
My question is where i need to init Firebase if i want to use firebase cloud and firebase realtime database for the same application.
So i want to have firebase.database().ref(‘sometable’) , but i want to use the database for push notifications aswell.
Looks like you need to import the module for init and then import all the other modules, for example, this is what I have in my imports:
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFirestoreModule,
AngularFireStorageModule,
AngularFireFunctionsModule,
1 Like
I will try that in a minute and will let you know.
So what i did is i uninstalled firebase, then i installed angular fire 2 with angularFireModule, imported the modules as you said and it worked like charm
thanks