I am trying to use Firebase Cloud Messaging with Angular2, but it looks like they donβt want us to be @Google.
I followed this and this to be able to stop the errors.
Now I am faced with the following problem: Why does messaging.getToken() not return anything? There is no error, there is no token in the console, nothing.
Any help is more than welcome. Thanks.
EDIT I updated the code below when trying to use onTokenRefresh() . This does not change anything. I feel this is due to the fact that I am not actually connected to my firebase files. Has anyone been able to do FCM with Angular2 and AngularFire2?
import {Component, OnInit, Inject} from '@angular/core'; import { FirebaseApp } from "angularfire2"; import * as firebase from 'firebase'; @Component({ templateUrl: './+config.component.html', styleUrls: ['./+config.component.scss'] }) export class UserConfigComponent implements OnInit { private _messaging: firebase.messaging.Messaging; constructor(@Inject(FirebaseApp) private _firebaseApp: firebase.app.App) { this._messaging = firebase.messaging(); } ngOnInit() {
angular firebase firebase-cloud-messaging angularfire2
Tom
source share