How to subscribe to a topic in flutter FCM?
up vote
-1
down vote
favorite
I'm a new one in a flutter and in my app, I need to implement FCM with global or with a topic subscription. I successfully implemented the FCM with device token but need to send a notification to all device. how can we fix this?
firebase dart flutter firebase-cloud-messaging
add a comment |
up vote
-1
down vote
favorite
I'm a new one in a flutter and in my app, I need to implement FCM with global or with a topic subscription. I successfully implemented the FCM with device token but need to send a notification to all device. how can we fix this?
firebase dart flutter firebase-cloud-messaging
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I'm a new one in a flutter and in my app, I need to implement FCM with global or with a topic subscription. I successfully implemented the FCM with device token but need to send a notification to all device. how can we fix this?
firebase dart flutter firebase-cloud-messaging
I'm a new one in a flutter and in my app, I need to implement FCM with global or with a topic subscription. I successfully implemented the FCM with device token but need to send a notification to all device. how can we fix this?
firebase dart flutter firebase-cloud-messaging
firebase dart flutter firebase-cloud-messaging
asked Nov 10 at 4:39
Ajnas Askar
307
307
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
You can use subscribeToTopic to send a notification to all devices on login success or somewhere where you want to subscribe.
sample code:
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
void fcmSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
void fcmUnSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
Test the topic subscription by using firebase console to send the notification to a topic that the device is listening by choosing the topic in target
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You can use subscribeToTopic to send a notification to all devices on login success or somewhere where you want to subscribe.
sample code:
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
void fcmSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
void fcmUnSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
Test the topic subscription by using firebase console to send the notification to a topic that the device is listening by choosing the topic in target
add a comment |
up vote
2
down vote
You can use subscribeToTopic to send a notification to all devices on login success or somewhere where you want to subscribe.
sample code:
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
void fcmSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
void fcmUnSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
Test the topic subscription by using firebase console to send the notification to a topic that the device is listening by choosing the topic in target
add a comment |
up vote
2
down vote
up vote
2
down vote
You can use subscribeToTopic to send a notification to all devices on login success or somewhere where you want to subscribe.
sample code:
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
void fcmSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
void fcmUnSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
Test the topic subscription by using firebase console to send the notification to a topic that the device is listening by choosing the topic in target
You can use subscribeToTopic to send a notification to all devices on login success or somewhere where you want to subscribe.
sample code:
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
void fcmSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
void fcmUnSubscribe()
firebaseMessaging.subscribeToTopic('TopicToListen');
Test the topic subscription by using firebase console to send the notification to a topic that the device is listening by choosing the topic in target
answered Nov 10 at 6:59
Aravindh Kumar
202217
202217
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236037%2fhow-to-subscribe-to-a-topic-in-flutter-fcm%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown