Hi @Omkar Pawar,
Welcome to the Microsoft Q&A Platform!
Your app is working fine with Firebase, and there's no problem with Firebase itself. However, it seems like the issue is how Azure Notification Hubs is sending messages to your.NET MAUI app. Specifically, the way Azure handles tokens from Firebase (called FCM v1 tokens) might be different in a.NET MAUI environment compared to how it worked in older Xamarin projects.
- Ensure your app is sending the correct token to Azure Notification Hub during registration. Log the token that your app generates and compare it with the token which is working as a result of the message from Firebase Console, they should be same.
- Ensure you have setup Azure Notification Hub correctly to make use of latest version of the Firebase API. (FCM v1 and not the previous version).
- Make sure that you have successfully added the appropriate information from your Firebase Service Account to Azure Notification Hub. That is, it must contain all the required permissions.
- .NET MAUI does push notifications in a different manner than older Xamarin apps do. It utilizes IFirebaseMessagingService.
Ensure you have implemented:CrossFirebaseCloudMessaging.Current.OnNotificationReceived += (s, p) => { // Handle the notification received event Debug.WriteLine("Notification Received: " + p.Data); };
- Ensure your AndroidManifest.xml file contains all of the permissions that your app requires to receive push notifications:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
- Instead of a notification payload, try sending a data-only message via Azure to see if it reaches the app:
{ "data": { "title": "Test", "body": "This is a test notification" } }
- Enable detailed logging in Azure Notification Hub. This will help you see exactly what's happening when Azure tries to send a message to your device, which can be very helpful for troubleshooting.
Overview:
https://learn.microsoft.com/en-us/samples/dotnet/maui-samples/webservices-pushnotifications/
https://learn.microsoft.com/en-us/dotnet/maui/migration/push-notifications?view=net-maui-9.0
Hope the above provided information help in better understanding and help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.