fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
624 stars 990 forks source link

fcm.onNotification() how to make it synchronous?? #598

Open saty932 opened 4 years ago

saty932 commented 4 years ago

I have to show some content based on fcm data what i fetch but the problem is it's taking time to fetch data from notification mean while it's navigating to some other page.I have to wait until fcm data fetched properly.

this.fcm.onNotification().subscribe(data => {
                 if(data.data){
                   //show offers according to notification data
                 }
               else{
               //no fcm data go to offers page show old offers which are in nativestorage
                }

}
});

now the problem is above method triggers when there is notification data other wise it's not gonna trigger at all.

how should i handle this case??