The Token Is only retrieved on first install of the App. if a mistake is made you need to uninstall the app and try again. Works good. excellent video.
I dont see the part in the video where the FirebaseApp and authentication is created... ? My OnNewToken is never executed? What are the contains of the admin_sdk.json, since I can't tell what fields are needed to authenticate to FCM before getting a PNS handle. Thanks
after adding all three plugins still not getting the option Googleplay services Json???Also not adding json file directly in android we need to put it in a folder.
Thank you for sharing! I have a question at 26:39, I got success response, however my device dosn't receive any notification (in top notification bar), do you know what possibly went wrong?
Hi Pragnesh, I tried to implement this but somehow FirebaseService class is not getting hit, so its not creating device token. Then I cloned your repo and its same for that as well. FirebaseService is not getting hit. Any thoughts? fyi - I have added my google service json and fcm server key. project is building and running but firebase service is not working
HI Abhay, Can you check bundle identifier is matching with google service json package name & also Build Action of google service json set to GoogleServiceJson, And if you are testing my project in your system, then add application with this package name "com.companyname.pushnotificationdemomaui" in your firebase console and then download google service json and try to test it.
@@ProgrammingWithPragnesh I have the same problem. FirebaseService never gets hit, so not creating device token. My google-service.json is set to GoogleServiceJson and the package name is well defined on Firebase
I had the same issue, firebase service seems to be called once first time install app on device, if you clear the preferences and delete the token, firebase no ask a new token, so everytime i have uninstalled application and redeploy it, i tested it in debug mode, and Firebase will be called only first time you open the app..
Hi Pragnesh, 38:28 at this time i am facing the same error when i click on the notification message on the foreground please let me know. how can i resolve this problem.
When I install my app notifications are disabled. How can I enable them or prompt the user to enable them? If I don't enable them notifications are not shown, but if I enable them manually (Settings -> Notifications) it works.
I think from android 13 you can request runtime permission for push notification. add this in androidmanifest.xaml file and target android version to android 13
Hi, it's very helpful for me but I am looking for schedule notifications like (day wise ,alternative ,weekly ,monthly). Can you please give me any suggestion for this how can I implement the notification
Hi! i have a question, how i make a background service in maui (android) project? my Idea is that i base on background service to get data from database, and then push notification to maui android. How i can do that? i have just stuck at "how make my maui app running background", even enduser do not open my maui app. Any else help me! thanks so much
Hi, I have created one video on foreground service (application run even entire app is closed) but that in Xamarin not in .NET Maui, You can follow the step and try to implement in Maui/Platform/Android. Here is the video link : ua-cam.com/video/0hp-yGCyHh8/v-deo.html
@@ProgrammingWithPragnesh i did that on maui android. But can i ask one more question. How i can pass context ( using EF core) to foreground service? my purpose is access to database and then do some logical. Hopefuly receive your answer.
Hi. Thanks for the gr8 content. I've a problem when I try to Add The Logic Related To Send Notification.. The "PushNotificationRequest" is not exist, even I did import all the required plugins, what seems to be the problem? and how can I fix it ? which namespace/pakckage that I need to import in order to solve this problem.. :D
public class PushNotificationRequest { public List registration_ids { get; set; } = new List(); public NotificationMessageBody notification { get; set; } public object data { get; set; } } public class NotificationMessageBody { public string title { get; set; } public string body { get; set; } }
Hi Pragnesh, when I clone your project, it can't find the dependencies for the AndroidX and Firebase namespaces, which are used to call the service. Do you have any suggestions on this? Thanks
Hi, you need to use http v1 for sending firebase push notification. or need to enable legacy http call for firebase. firebase.google.com/docs/cloud-messaging/migrate-v1
Hi Its working fine withing one devices ,msg is not coming on another devices , I wanted to implement msg apear in all devices which is using same channel ? How this concept works. or poeple login with same username in mobile app notitication comes to that group?
HI, Pragnesh... this is in regards to the error we are facing on clicking the notification..... If we change the MainPage = new AppShell(); from AppShell() to some other page... it is working. Could you please check this out. There is some problem with the routing
Thanks Pragnesh. Do you/anyone know why it crashes when Notification Clicked? Error at MainActivity.cs base.OnCreate(saveInstanceState); Error message - Java.Lang.IllegalStateException: 'FragmentManager has been destroyed' Thanks in advance.
Hi, thank you for detailed video. I have one issue.. if the App is not running and then i send notification via PostMan then it doesn't pop. Can you please help on this?
Hi, I am not able to run iOS app in real device with push notification configuration. I have created blog about implementing notification in iOS, You can take a look at this: xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html
Hi Pragnesh! Thanks for the video. I tried to set the Build Action of google service json to GoogleServiceJson but the option never appear on list. Thanks
@@ProgrammingWithPragnesh I think I found the problem. In the .csproj file I have a line called false because in VS 17.4 preview Microsoft.Maui crash on splash after execute the project. I installed the 17.3 (not preview) and removed this line. Thanks!
hello sir, thanks first for this.However , the notifications are only working for me when the app is in the foreground mode .When inactive(that is , i completely close the app ), the app fails to receive the push notifications.How can we fix that ? thank you.
Hola gracias por tu aporte, en net6 funciona bien, en net8 no habilita el permiso de notificaciones, si le doy el permiso a la app funciona, pero no lo hace de forma automática, sabes que pudo haber cambiado de net6 a net8 en lo que refiere a permisos? muchas gracias
Hello, thanks for your contribution, in net6 it works fine, in net8 it doesn't enable the notifications permission, if I give permission to the app it works, but it doesn't do it automatically, you know that it could have changed from net6 to net8 in what Do you mean permissions? thank you so much@@Nahuel-223
I am facing the issues FirebaseService not executing and not creating the token. Project Package Id and google-services.json package id also same can you guide me what is the exact issues?
actually the token was null. now i fixed token issue ...but i am getting an exception a long one which says Java.Lang.IllegalArgumentException .... something flag_immutable or flag_mutable in firebase service ... sendNotification method line no. 47 pendingIndent
Hi Mohamed Cisse , I have created a blog for push notification in iOS you can go through this. xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html I am not able to test push notification on real device due to that I didn't recorded video.
Hi, I have created blog related to implementing in push notification in iOS: xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html
Hi , please assist with this error: Java.Lang.IllegalArgumentException: 'com.companyname.pushnotificationdemomaui: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
@@leonardocardosodasilveira3251 .While trying to implement it in .net 8, I get a conflict error between packages when I download the mentioned packages. How did you overcome this?
Never execute Android > Services > FirebaseService > OnNewToken() this method never called, Is there any specific config for it. like register that service anywhere? or will it execute only on the actual android device not in an emularor.
Hi Ketan, I have tested in android emulator too it's working for me, can you use my project, and also can you add app in firebase console with this identifier "com.companyname.pushnotificationdemomaui" and that service json content add in google-service.json file. and try to test it.
@@natureandfun62 Hi, There are two way you can send notification to multiple devices, One You can Use FirebaseAdminSDK Or other just pass list of device tokenIDs here in registration_ids property of PushNotificationRequest class. public class PushNotificationRequest { public List registration_ids { get; set; } = new List(); public NotificationMessageBody notification { get; set; } public object data { get; set; } } public class NotificationMessageBody { public string title { get; set; } public string body { get; set; } }
@@natureandfun62 You need to save device token In your Server Side DB Like SQL, So when user install and launch the app you will get the device toke, Save that token in your DB. And later on use that for sending notifications.
The Token Is only retrieved on first install of the App. if a mistake is made you need to uninstall the app and try again. Works good. excellent video.
Thank you so much.
was looking for this. Thank you Pragnesh for this amazing To the point tutorial
Glad you liked it
Great Pragnesh....Thanks for your help..... Expecting future video on background tasks in maui...Thanks........
Thank you Robin, and sure I will create video for it in future.
Seria genial eso
can we have a google meeting with you please.the notifications are not working for me when the app is in the background mode.THANKS.
Have you solved the problem yet?@@kelvinkirwa4887
I dont see the part in the video where the FirebaseApp and authentication is created... ? My OnNewToken is never executed? What are the contains of the admin_sdk.json, since I can't tell what fields are needed to authenticate to FCM before getting a PNS handle. Thanks
Wah pragnesh bhai wah mast che....
after adding all three plugins still not getting the option Googleplay services Json???Also not adding json file directly in android we need to put it in a folder.
Thank you for sharing! I have a question at 26:39, I got success response, however my device dosn't receive any notification (in top notification bar), do you know what possibly went wrong?
Did you allowed push notification permission from device setting?, because in newer android device we need to set push notification permission.
Thank you Pragnesh this was immensely helpful!
Hi Pragnesh, I tried to implement this but somehow FirebaseService class is not getting hit, so its not creating device token. Then I cloned your repo and its same for that as well. FirebaseService is not getting hit. Any thoughts?
fyi - I have added my google service json and fcm server key. project is building and running but firebase service is not working
HI Abhay, Can you check bundle identifier is matching with google service json package name & also Build Action of google service json set to GoogleServiceJson,
And if you are testing my project in your system, then add application with this package name "com.companyname.pushnotificationdemomaui" in your firebase console and then download google service json and try to test it.
@@ProgrammingWithPragnesh Buil action i already changed. let me check for package in service json
@@ProgrammingWithPragnesh I have the same problem. FirebaseService never gets hit, so not creating device token. My google-service.json is set to GoogleServiceJson and the package name is well defined on Firebase
I had the same issue, firebase service seems to be called once first time install app on device, if you clear the preferences and delete the token, firebase no ask a new token, so everytime i have uninstalled application and redeploy it, i tested it in debug mode, and Firebase will be called only first time you open the app..
Did you find any solution for this? I have the same issue
Hi Pragnesh, 38:28 at this time i am facing the same error when i click on the notification message on the foreground
please let me know. how can i resolve this problem.
Hi, I didn't tried in lates .NE7 7 MAUI Project, I will check and let you know.
Hi, i fixed the crash issue of notification. You can go through my latest video Implement push notification in .net maui part 2
@@ProgrammingWithPragnesh thank u
Thanks for all videos that you share, they really helpful. Will you do the IOS part for Push Notifications too? Best regards
Yes I will
Great! I added topics to your example and it works!
When I install my app notifications are disabled. How can I enable them or prompt the user to enable them? If I don't enable them notifications are not shown, but if I enable them manually (Settings -> Notifications) it works.
I think from android 13 you can request runtime permission for push notification.
add this in androidmanifest.xaml file and target android version to android 13
Hi, it's very helpful for me but I am looking for schedule notifications like (day wise ,alternative ,weekly ,monthly).
Can you please give me any suggestion for this how can I implement the notification
nice tuto.
Thank you.
Have you found the way to fix application crash when open notification while application is open?
hey ? are you able to receive the notification when the app is not running , i mean when you've not opened it ? thank you.
Muito bom o video, implementei em um projeto Maui Blazor e funcionou perfeitamente !
Funcionou para o framework 7 ?
@@duartebeck não sei dizer, eu implementei em um projeto Maui blazor Android
Thanks for helping and supporting
Hi! i have a question, how i make a background service in maui (android) project?
my Idea is that i base on background service to get data from database, and then push notification to maui android. How i can do that? i have just stuck at "how make my maui app running background", even enduser do not open my maui app. Any else help me! thanks so much
Hi, I have created one video on foreground service (application run even entire app is closed) but that in Xamarin not in .NET Maui, You can follow the step and try to implement in Maui/Platform/Android.
Here is the video link : ua-cam.com/video/0hp-yGCyHh8/v-deo.html
@@ProgrammingWithPragnesh thank you so much
@@ProgrammingWithPragnesh i did that on maui android. But can i ask one more question. How i can pass context ( using EF core) to foreground service? my purpose is access to database and then do some logical. Hopefuly receive your answer.
is it still topical? i can't set google services in file options, that option is missing for me
Hi you need to install Xamarin.Google,Dagger plugin in your android platform then just rebuild or close and re-open visual studio.
yeah i did all of that and nothing maybe its cuz i have the newest VS studio. So i don't know what to do i was hopping on this notifications
Hi. Thanks for the gr8 content.
I've a problem when I try to Add The Logic Related To Send Notification..
The "PushNotificationRequest" is not exist, even I did import all the required plugins, what seems to be the problem? and how can I fix it ? which namespace/pakckage that I need to import in order to solve this problem.. :D
public class PushNotificationRequest
{
public List registration_ids { get; set; } = new List();
public NotificationMessageBody notification { get; set; }
public object data { get; set; }
}
public class NotificationMessageBody
{
public string title { get; set; }
public string body { get; set; }
}
Hi Pragnesh, when I clone your project, it can't find the dependencies for the AndroidX and Firebase namespaces, which are used to call the service. Do you have any suggestions on this? Thanks
Great Content!!! How do you make the notification pop up?
The firebase service has changed, I always get on this version an authorized failed status.
Hi, you need to use http v1 for sending firebase push notification. or need to enable legacy http call for firebase.
firebase.google.com/docs/cloud-messaging/migrate-v1
Hi Its working fine withing one devices ,msg is not coming on another devices , I wanted to implement msg apear in all devices which is using same channel ? How this concept works. or poeple login with same username in mobile app notitication comes to that group?
It works, thank you very much
bạn ơi, cho mình hỏi chút về cái này với ạ?
@@ducvunguyen5607 bạn hỏi gì nhỉ
Does this sample works directly or need to modify on our machine?
Hi Vipul, you need to add google service json file in your android platform.
HI, Pragnesh... this is in regards to the error we are facing on clicking the notification.....
If we change the MainPage = new AppShell(); from AppShell() to some other page... it is working. Could you please check this out. There is some problem with the routing
Thank you so much robin, i will check this. and notification implementation working for you right?
That is awesome thank you, Can you make an example for IOS please?
Yes I will.
@@ProgrammingWithPragnesh when?
Thanks Pragnesh. Do you/anyone know why it crashes when Notification Clicked? Error at MainActivity.cs base.OnCreate(saveInstanceState); Error message - Java.Lang.IllegalStateException: 'FragmentManager has been destroyed' Thanks in advance.
I am having the same issue. Did you find a solution yet?
I'm having the same issue too. Did you find a solution?
@@giorgosbetsos5635 I'm having the same issue too. Did you find a solution?
mismo problema
Hi, do you have a Huawei Push Kit example ? This works perfectly on Android devices that's not Huawei.
No , i dont have Hawei Push Kit demo.
Hi, thank you for detailed video.
I have one issue.. if the App is not running and then i send notification via PostMan then it doesn't pop. Can you please help on this?
Excellent videos. can you do this for IOS please
Hi, I am not able to run iOS app in real device with push notification configuration.
I have created blog about implementing notification in iOS, You can take a look at this:
xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html
Hi Pragnesh! Thanks for the video. I tried to set the Build Action of google service json to GoogleServiceJson but the option never appear on list. Thanks
HI, You need to Install Xamarin.Google.Dagger Plugin in Your Android Dependency, In video I shown about installing package from 4:25
I follow all the steps in the video. Restarted Visual Sudio and it doesn't appear. Do you think I am missing something?
I m not sure bro, you can download my git repo from description and check for that GoogleServiceJson option.
and also the list of plugin i installed.
I will!
@@ProgrammingWithPragnesh I think I found the problem. In the .csproj file I have a line called false because in VS 17.4 preview Microsoft.Maui crash on splash after execute the project. I installed the 17.3 (not preview) and removed this line. Thanks!
FCM token is not getting genrated in FirebaseService.
hello sir, thanks first for this.However , the notifications are only working for me when the app is in the foreground mode .When inactive(that is , i completely close the app ), the app fails to receive the push notifications.How can we fix that ? thank you.
Hola gracias por tu aporte, en net6 funciona bien, en net8 no habilita el permiso de notificaciones, si le doy el permiso a la app funciona, pero no lo hace de forma automática, sabes que pudo haber cambiado de net6 a net8 en lo que refiere a permisos? muchas gracias
in inglish
Hello, thanks for your contribution, in net6 it works fine, in net8 it doesn't enable the notifications permission, if I give permission to the app it works, but it doesn't do it automatically, you know that it could have changed from net6 to net8 in what Do you mean permissions? thank you so much@@Nahuel-223
how to get token? i can login with email and passwork to firebase to get it
Hi, does the device token have a lifetime?
Firebase Console is free for unlimited ?
Push Notification & Crashlytic is free and for other you can see pricing here : firebase.google.com/pricing
@@ProgrammingWithPragnesh Do you have push notification sample for both android , ios . I can pay you
I am facing the issues FirebaseService not executing and not creating the token. Project Package Id and google-services.json package id also same can you guide me what is the exact issues?
I have a problem when I try to send the notification from the app it shows me unauthorized. But it is being sent from the site. can you help
Hi thank you, this works great. Any plans to do iOS?
hello ? are you able to receive the notification even when the app is not actively running ?
does it work in .net 8?
i keep getting [FirebaseInstanceId] Failed to get FIS auth token
any way to resolve this?
Thank you
Thank you so much.
in my case once i click on the button it shows notification send but i can't see any notification ... can u plx help
actually the token was null. now i fixed token issue ...but i am getting an exception a long one which says
Java.Lang.IllegalArgumentException .... something flag_immutable or flag_mutable in firebase service ... sendNotification method line no. 47 pendingIndent
Did someone figured out the error on Notification Clicked? Thank you in advance
Thanks Gerald. Did you get any solution of this?
Hi Pragnesh
How to implement push notification in .NET MAUI (ios) ?
Thanks
Hi Mohamed Cisse , I have created a blog for push notification in iOS you can go through this.
xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html
I am not able to test push notification on real device due to that I didn't recorded video.
@@ProgrammingWithPragnesh
Thanks
in net7 not working at all
Waiting for iOS 💕💕💕💕💕💕
Hi, I have created blog related to implementing in push notification in iOS: xamarincodingtutorial.blogspot.com/2022/10/implement-push-notification-in-net-maui.html
Hi , please assist with this error: Java.Lang.IllegalArgumentException: 'com.companyname.pushnotificationdemomaui: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
Please kindly assist
Hi , at 31:55 min in video i m creating pending intent there can you try to pass flag like mutable or immutabls
@@ProgrammingWithPragnesh please reply with code example 🙌
var pendingIntent = PendingIntent.GetActivity(this,
MainActivity.NotificationID, intent, PendingIntentFlags.UpdateCurrent |PendingIntentFlags.Immutable);
@@ProgrammingWithPragnesh Thank you so much , it's working now.
Thank you!
You're welcome!
Did anyone figured out how to solve that app crush when notification clicked and app is opened?
can you please provide tutorial to do this for targeted framework net7.0-android
I use this with .net 8, what is your problem ?
@@leonardocardosodasilveira3251 .While trying to implement it in .net 8, I get a conflict error between packages when I download the mentioned packages. How did you overcome this?
Never execute Android > Services > FirebaseService > OnNewToken() this method never called,
Is there any specific config for it. like register that service anywhere? or will it execute only on the actual android device not in an emularor.
HI Ketan, Can you check in real device and let me know it's working or not?
Hi Ketan, I have tested in android emulator too it's working for me, can you use my project, and also can you add app in firebase console with this identifier "com.companyname.pushnotificationdemomaui" and that service json content add in google-service.json file. and try to test it.
@@ProgrammingWithPragnesh Thanks for the quick response, let me try it. again using your project.
@@ProgrammingWithPragnesh OnnewToken never hit, although change package name to mine. does it need to add service to MauiProgram.cs?
Just check, device token is not null in emlator but null in real device, push notification is not hit
Has anyone actually got this to compile under .Net 7 and Maui?
but this is missing API part , can u plxx create one video ...... To send push notification from api ..... to android or ios
i did that thing by myself ... now can u tell me how to send notification to all users or devices
@@natureandfun62 Hi, There are two way you can send notification to multiple devices, One You can Use FirebaseAdminSDK Or
other just pass list of device tokenIDs here in registration_ids property of PushNotificationRequest class.
public class PushNotificationRequest
{
public List registration_ids { get; set; } = new List();
public NotificationMessageBody notification { get; set; }
public object data { get; set; }
}
public class NotificationMessageBody
{
public string title { get; set; }
public string body { get; set; }
}
FirebaseAdminSDK will be easy to send notification to both android & ios devices
@@ProgrammingWithPragnesh btw where can i get these registration ids... or how can i get these
@@natureandfun62 You need to save device token In your Server Side DB Like SQL,
So when user install and launch the app you will get the device toke, Save that token in your DB. And later on use that for sending notifications.
notificationManager.Notify(MainActivity.NotificationID, notificationBuilder.Build()); not show notification
fiz igual, mas minha notificação não chega D:Fiz o mesmo, mas minha notificação não chega :D:
Great video ! By the way i just begin develop an API but when i use post httpclient my app crashes immediatly , any ideas . ?
Hi, if you are using http url then try to add android:usesCleartextTraffic="true" in manifest file.
@@ProgrammingWithPragnesh you're the best ! Thanks so much !!!
Thanks!
Thank you so much for your support.