I'm trying to get the push notifications working. Starting with the client app I added the FCM plugin to the ionic project, imported in app.module.ts and listed it in providers.
Then in app.component.ts
import { FCM } from '@ionic-native/fcm';
constructor(..., public fcm: FCM) {
platform.ready().then(() => {
...
this.fcm.getToken().then(token=>{
console.log(token);
});
this.fcm.onNotification().subscribe(data => {
if(data.wasTapped){
console.log("Received in background");
} else {
console.log("Received in foreground");
};
});
this.fcm.onTokenRefresh().subscribe(token => {
//backend.registerToken(token);
console.log('token changed ', token);
});
this.fcm.subscribeToTopic('general');
});
}
And I wanted to test how does it work from the FCM website. It works when I send it directly to device through its token. It works also when I send it to devices subsribing the topic 'general'. But it doesn't work when I send it just to the users of the app even though it shows me that there are 2 users right now. example here
Then I also added the FCM server key to Azure Notification Hub and wanted to send a test message from Azure portal, but it wasn't delivered.
If I don't subscribe to any topic in the app.component.ts it also doesn't receive any notification designated to all users of the app.