Nativescript-plugin-firebase cloud messaging



I have already notifications with firebase, with firebase console all is done, but I want to send my notifications to all the devices but I do not know how, I have read that I need to create a topic, register the device to this topic and when I send this notification to the topic all devices are in.

The problem is that I do not know how to create this topic and how to subscribe the device.

I want to send this notification wit a post request on my server.

Thanks a lot !


For now topics not supported from nativescript-plugin-firebase, so for now you will have to send notifications to devices per token


Thanks markosko I am trying to send notification with device token but I get “invalid token” error.

Do you have an example of this? this token expire? can I send to all my devices token in one post request?

I really appreciate your help.

Thanks !


Every time u use tns run command it will wipe out token so thats one thing, then token expires each time users delete app cache, FCM reset token to other token (FCM will send back response which need to parsed to change old token to new) which can happen ± every 6months, and notification can be send to upto 1000 tokens per one request but thats quite fast :slight_smile:


I get it, thanks a lot.

I am very confused, sorry if I still asking, but is what is the best solution for this problem?

I am thinking in store each device´s token on a db to get it on the post request list. But I get the possibility to know when this token get refreshed to update it in my db?

It´s my first app sorry if I look so newbie.



u can get token from app somehow or u will get info from response back from sending notifications :slight_smile:


does anyone have code to share, like a simple sample app, that shows push notifications working with Firebase? I haven’t yet touched this (but I’m going to need to…) - push notifications can be really hard to get right cross-platform.


Have done only for testing topics, but its same for normal messages too, for Firebase plugin topics at android works dont have mac but shouldnt be hard to rewrite android code to ios code :smiley:


I think I should do a push notification test case as a blogpost. OK folks look for this one coming soon!


@jen.looper You can add topics to blogpost too now as they have been added to plugin :slight_smile:


Is the plugin supporting topics on iOS already?


yeah android and iOS was added at same time at january this year