ionic 5 "firebasex" plugin grant Permission tutorial
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
constructor(private firebaseX: FirebaseX) { }
...
this.firebaseX.getToken()
.then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
.catch(error => console.error('Error getting token', error));
this.firebaseX.onMessageReceived()
.subscribe(data => console.log(`User opened a notification ${data}`));
this.firebaseX.onTokenRefresh()
.subscribe((token: string) => console.log(`Got a new token ${token}`));