Ionic 5 Capacitor 3 save data to local storage when Push Notification arrive (background & foreground)

Hello i am using Ionic 5 and Capacitor 3
I am using PushNotifications plugin

I want to store data from push notification to local storage when users receive notification, either from foreground or background without tap the notification from notification center.

I cannot achieve with my PushNotification function. Because it’s only firing when app open or user tap the notification.

    // handling notification received in foreground
    await PushNotifications.addListener('pushNotificationReceived', (dataNotification: PushNotificationSchema) => {

    // handling notification tapped
    await PushNotifications.addListener('pushNotificationActionPerformed', (dataNotification: ActionPerformed) => {

I try to use FCM onNotification but it’s incompatible with Capacitor.

Is there any solution ?

Thank you!