ravishankarsingh1996 / fcm-push-notification-python-script

A python script that send push notification to devices with device token.
15 stars 4 forks source link

deviceToken? #2

Open Jared-Gross opened 3 years ago

Jared-Gross commented 3 years ago

Where exactly do we get this Device Token????

It's really unclear.

s4rath commented 6 months ago

device token is the unique id for every registered device. To get that unique id for flutter you need to call FirebaseMessaging instance and getToken() method import 'package:firebase_messaging/firebase_messaging.dart'; final _firebaseMessaging = FirebaseMessaging.instance; await _firebaseMessaging.requestPermission(); String? fCMToken = await _firebaseMessaging.getToken(); print('Token: $fCMToken'); you can copy paste it or in realworld application you need to add this in database for unique users and can be used to send notification to that particular user. Hope this clear your doubt. :)