We are using ionic native FCM plugin which in background is using https://github.com/fechanique/cordova-plugin-fcm
We do nothing special, simple code like docs described:
fcm.subscribeToTopic('abcdef');
fcm.getToken().then(token=>{
console.log('FCM token:', token);
});
fcm.onNotification().subscribe(data=>{
console.log('onNotification, data:', data);
if(data.wasTapped){
console.log('Received in background');
} else {
console.log('Received in foreground');
};
})
fcm.onTokenRefresh().subscribe(token=>{
console.log('FCM refresh token:', token);
})
fcm.unsubscribeFromTopic('abcdef);
the problem is if we run the app in background, also not closed but only in background, the Notification is appearing in the notifications try and if we tapped on it the app is opening but the onNotification event is not fired and so also data.wasTapped is never true.
So the implementation is working well for foreground notifications but not so good for background notifications.
So perhaps we are misunderstanding somthing?