⚠ Update : The payload was not working in terminated state i have fixed it , you need to use this function i have missed that in the video . add this after the handling foreground messages. // for handling in terminated state final RemoteMessage? message = await FirebaseMessaging.instance.getInitialMessage(); if (message != null) { print("Launched from terminated state"); //can change the waiting time depending on you app Future.delayed(Duration(seconds: 1), () { navigatorKey.currentState!.pushNamed("/message", arguments: message); }); } also updated the github repository.
Sir, can you make the tutorial on How to save fcm token in database and most important thing how we trigger automatic notification for example admin add some products it automatically push notification to user about adding product ❤
Hey, when I run the project I am getting an unsupported error: reconfigure your firebase cli and I am choosing option 2: chrome . Please help me please
Use `dart pub global activate flutterfire_cli` `flutterfire configure --project={your project id}` command to configure using firebase cli again and make sure web platform is selected.
if (kIsWeb){} use kIsWeb it is an inbuilt variable import from 'package:flutter/foundation.dart' , can be used to check if the platform is web or not. I am making a dedicated video regarding pushing notification on flutter web will be published soon.
sir when my app is on active tapping on notification redirecting to the particular page. But when my app is on background and kill i'm receiving notifications but tapping on notifications won't opening my app. and i cant getting any logs.
Hi, routing in specific page while tap on notification isn't working while app is terminated. I've done my code following all the steps that you showed here. Would please tell me reason. I think navogatorkey getting null while app is terminated that's why routing isn't working while app is terminated. BTW, nice tutorial.
While making this video I only did it for background and foreground. I will ask to have a look at the source code in GitHub I have added the logic to handle the notification in terminated state.
Count can be stored in a counter variable and can be access using provider or something else as you want. To make it like what app, Facebook we need to also customize the notification as per our need .
Hi.Im using firebase messaging in my flutter app. Why do I get this error: "Error: AbortError: Failed to execute 'subscribe' on 'PushManager': Subscription failed - no active Service Worker " when I run my Flutter app for the first time on Chrome browser, but if I restart the app or refresh the browser page, the error disappears? and how should i solve that?
i think you might have not initialize the the firebase properly , initialize in the main function. try this void main() { WidgetsFlutterBinding.ensureInitialized(); // Initialize the PushManager FirebaseMessaging.instance.initialize(); // Run your app runApp(MyApp()); } if this does not solve the issue you can ask me.
Is this working for terminated state of app.? I need to send notifications to all the app users in weekdays only even the app is closed. Can we do that ?
Hello, do you know how to implement the FCM v1 instead of the legacy? Some information on the google documentation is not clear for me, may you please assist me on that?
how to automate the push notification based on changes of documents/collection in firebase firestore? post a cideo if you knwo about this?thanks in advance
It takes some time for notification to arrive, as shown in the video you can test with firebase token first then it come instantly , then create a new campaign and test.
when i made this video i didn't add the code for terminated state state , but you can check the source code i have add the terminated state code ,please cooperate with that.
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Unsupported operation: DefaultFirebaseOptions have not been configured for windows - you can reconfigure this by running the FlutterFire CLI again. I got this error anfter running the app. I use windows by the way.
As the error says that you have not configure your firebase project for windows. Just configure it for windows also by running this command - flutterfire configure --project= and make sure to select windows as the platform.
⚠ Update :
The payload was not working in terminated state i have fixed it , you need to use this function i have missed that in the video .
add this after the handling foreground messages.
// for handling in terminated state
final RemoteMessage? message =
await FirebaseMessaging.instance.getInitialMessage();
if (message != null) {
print("Launched from terminated state");
//can change the waiting time depending on you app
Future.delayed(Duration(seconds: 1), () {
navigatorKey.currentState!.pushNamed("/message", arguments: message);
});
}
also updated the github repository.
i think you should pin this
Thank you so much bro, You saved my job and my life as well 🔥🔥🔥🔥🔥🔥
Such a wonderful tutorial with clear and detailed explanation. Thanks. Keep posting such videos.
Thank you
Thanks buddy... must Recommeded video for push notification
thanks a lot sir it's very nicely explained and also working.... helpful for me
Many thanks for this tutorial. This was very helpful 😊
Thank u for this tutorial. my question : while navigatorKey.currentContext is Always Null
Thanks from Japan.
Your Video is very useful to me.
Thank You Very Much!
sorry, my english is poor
THIS VIDEO IS REALLY VERY HELPFUL.....
I got two consecutive push notifications while my app is in background. kindly guide why this is happening.
i want to send schedule notification on specific device token using code , what will be the implemenation ???
Thanks. Worked for me.
Sir, can you make the tutorial on How to save fcm token in database and most important thing how we trigger automatic notification for example admin add some products it automatically push notification to user about adding product ❤
Ok I will do it
@@Snehasis4321 I will wait for it. Plz try to make tutorial soon. It's my humble request😥.
Please make video on How to play .MP3 file sound
Hey, when I run the project I am getting an unsupported error: reconfigure your firebase cli and I am choosing option 2: chrome . Please help me please
Use
`dart pub global activate flutterfire_cli`
`flutterfire configure --project={your project id}` command to configure using firebase cli again and make sure web platform is selected.
@@Snehasis4321 how to check web platform Is selected
if (kIsWeb){} use kIsWeb it is an inbuilt variable import from 'package:flutter/foundation.dart' , can be used to check if the platform is web or not.
I am making a dedicated video regarding pushing notification on flutter web will be published soon.
Thanks from INDORE .
Your Video is very useful to me.
Thank You Very Much! 💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌💌
thanks for video
how to send title,body to local notifications
in terminated state , the navigation is not working for schedule notification
sir when my app is on active tapping on notification redirecting to the particular page. But when my app is on background and kill i'm receiving notifications but tapping on notifications won't opening my app. and i cant getting any logs.
I have fixed this issue please check the latest source code.
Hi, routing in specific page while tap on notification isn't working while app is terminated. I've done my code following all the steps that you showed here. Would please tell me reason. I think navogatorkey getting null while app is terminated that's why routing isn't working while app is terminated. BTW, nice tutorial.
While making this video I only did it for background and foreground. I will ask to have a look at the source code in GitHub I have added the logic to handle the notification in terminated state.
@@Snehasis4321 I've follow these code for terminate state but routing not working while app is opened by tapping on notification in terminate state
@@mahbubpasha6176 did the problem got solved. i am also stuck there
Great work... How to show notifications count numbers of incoming notifications in app icon like what'sup, Facebook, Instagram...
Count can be stored in a counter variable and can be access using provider or something else as you want. To make it like what app, Facebook we need to also customize the notification as per our need .
@@Snehasis4321
So can you make in a tutorial
@@haiderjaafer8164 ok bro i will make a tutorial.
@@Snehasis4321
Thank a lot
Hi.Im using firebase messaging in my flutter app.
Why do I get this error: "Error: AbortError: Failed to execute 'subscribe' on 'PushManager': Subscription failed - no active Service Worker " when I run my Flutter app for the first time on Chrome browser, but if I restart the app or refresh the browser page, the error disappears?
and how should i solve that?
i think you might have not initialize the the firebase properly , initialize in the main function. try this void main() {
WidgetsFlutterBinding.ensureInitialized();
// Initialize the PushManager
FirebaseMessaging.instance.initialize();
// Run your app
runApp(MyApp());
} if this does not solve the issue you can ask me.
@@Snehasis4321 In fact, I have already done that.
void main()async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
FirebaseMessaging firebaseMessaging =FirebaseMessaging.instance;
NotificationSettings settings = await firebaseMessaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true);
final fcmToken = await firebaseMessaging.getToken(vapidKey:"***");
}
Is this working for terminated state of app.? I need to send notifications to all the app users in weekdays only even the app is closed. Can we do that ?
Yes it will work.
Hello, do you know how to implement the FCM v1 instead of the legacy?
Some information on the google documentation is not clear for me, may you please assist me on that?
did u implement FCM v1.
how to automate the push notification based on changes of documents/collection in firebase firestore? post a cideo if you knwo about this?thanks in advance
Ok I will do it.
thank you perfect work
Sir how to add action button in push notification
It work when required authentication before message screen?
I have not used any authentication, but if you want you can add authentication to you app.
best
when i tried the test i don't received the notification
?
It takes some time for notification to arrive, as shown in the video you can test with firebase token first then it come instantly , then create a new campaign and test.
it works now thank u for tuto and thank u for replaying@@Snehasis4321
terminated state notificaton not recived
when i made this video i didn't add the code for terminated state state , but you can check the source code i have add the terminated state code ,please cooperate with that.
Why you use vs code instead of android studio, and whats your machine’s configuration
Vscode is more lightweight and I know all the shortcuts of it , it helps me code faster.
@@Snehasis4321 okayyy .. how much ram does your machine have, and also you have earned a subscriber ;)
@@shubhammankar6047 8gb ram bro
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Unsupported operation: DefaultFirebaseOptions have not been configured for windows - you can reconfigure this by running the FlutterFire CLI again. I got this error anfter running the app. I use windows by the way.
As the error says that you have not configure your firebase project for windows.
Just configure it for windows also by running this command -
flutterfire configure --project=
and make sure to select windows as the platform.