Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

onNotification with FCM push

$
0
0

@mcihak wrote:

Hi all,
I decided to try implement push notification width FCM plugin. I have whole implementation in platform.ready() function. The notification is received but onNotification function is not fired (console.log is not printed). What can be wrong with my implementation? It is from docs.

 this.fcm.subscribeToTopic('all');

        this.fcm.getToken().then(token => {
            console.log("FCM TOKEN: ", token);
            localStorage.setItem("registrationId", token);
        })

        this.fcm.onNotification().subscribe(data => {
            console.log("NOTIFICATION DATA: ", data) //this line is not printed after receive push
            if (data.wasTapped) {
                console.log("Received in background");
            } else {
                console.log("Received in foreground");
            }
            ;
        })

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>