I am trying to send notification from Java Rest Api (using Firebase Admin sdk) to my Flutter application and it seems it requ
As you can the use the firebase Messaging Plugin to send the Notification. Through this code you can print the Token in Console.
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
_firebaseMessaging.configure(
onLaunch: (Map message) {
print('onLaunch called');
},
onResume: (Map message) {
print('onResume called');
},
onMessage: (Map message) {
print('onMessage called');
},
);
_firebaseMessaging.subscribeToTopic('all');
_firebaseMessaging.requestNotificationPermissions(IosNotificationSettings(
sound: true,
badge: true,
alert: true,
));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print('Hello');
});
_firebaseMessaging.getToken().then((token) {
print(token); // Print the Token in Console
});
}