Xamarin Firebase push notification - intermittent duplicate push notification received on Android - c#

My Android APP is written in C#, it uses Azure Push Notification service to send push notification to Android via Firebase (FCM), iOS via Apple Push service. The push notification registration happens when the app is installed (the app also removed all previous registrations).
The push notification on iOS is working perfectly.
On Android, sometimes it receives duplicate notifications:
intermittent (not always)
on some devices only
happen on all scenarios when app is in foreground, background, killed
duplicate notifications received at the same time
and based on my DB record, i'm sure the application sends out only 1 notification.
I had suspected the registration process caused the duplicate token in FCM. But later on I found out the duplication happens out of the blue, without any new uninstall/install happened on the device.
Any idea please? this has taken a lot of my time.

This same issue I also had. To solve it, before you register with the Notification Hub, unregister the previous tags belongs to that device,
await Task.Run(() =>
{
hub.Unregister();
});
Then you register with the Notification Hub again.

Related

ASP.NET Core web notification implementation

For the intranet company, I want to send to user web notification. This notification could be general (new feature in the intranet) or for a specific user (a task is ready to pick up or an import is completed).
I started to use SignalR but the user receives the notification only if the intranet is open. So, I'm looking around to implement a different web notification and I saw some posts:
https://blog.elmah.io/how-to-send-push-notifications-to-a-browser-in-asp-net-core/
https://labs.bawi.io/web-push-notifications-through-vapid-method-7d4d6927a006
https://www.tpeczek.com/2017/12/push-notifications-and-aspnet-core-part.html
https://webpushdemo.azurewebsites.net/
I can't find an end-to-end implementation in ASP.NET Core. On GitHub I found a few projects but again when I close the browser, I can't receive the notification.
I can't find any Microsoft documentation for that. Can you point me in the right direction please?
Update
The idea is:
Setting up a minimal PWA
Subscribe to Push Notifications
Send Push Notifications
Receive Push Notifications
Show Push Notifications

C# UWP Difference between Toast notifications & Push notifications

As far as i know, toast notifier in UWP is just like a messagebox. But the difference is messagebox will appear as a pop-up within the app. Where as Toast notification will appear out of the application.
And i don't know what is Push Notification.
Push Notifications are send from the web server. For example, service can send push notification that there is a sale and you can buy app with a discount or that there is a new release and you can update your app or read 'what's new'. While Toasts are created with your local app code.
It's called Push since notification originate from webserver. You can poll server yourself, but it will be Pull approach. For more info regarding Push take a look at the following article.
For more info regarding Push Notifications in UWP see the link.

Create Push notifications for Xamarin.Android without using FCM

I'm creating a xamarin.forms application and have got most of the app completed. My only hickup is push notifications. I'm sending my notifications to the app using SignalR and a .Net Web API Server. I'm able to receive notifications while the app is running however, I can't see tutorials for push notifications while the app is asleep. I've checked out services as well. Thank you for you help in advance.
SignalR is not a push notification and there is a difference between them.The main difference is that in case of SignalR you have to keep an opened connection to your hub in order to receive events / signals. So if you want to receive notifications while the app is killed or in background SignalR is a wrong solution since it is technically impossible to keep your application always running on a mobile device. However, push notification can awake your application when it is killed or in background.
I would suggest to rethink your current solution instead of looking for hacks.

Apple Push Notifications dropped from Azure

I have developed a ASP.NET MVC web application that exposes several APIs. One such API is to send a push notification via apple APNS to users. In my c# code i run parallel tasks for each notification that should be sent out. We are then calling Apple APIs direct. Some users are complaining that intermittently they do not receive push notifications. I wanted to know if there are some things to be aware of when attempting to send push notifications from Azure?
Thanks in advance.

Push notification issues in C# for iPhone?

I have used the push notification in my app and I have used our own server, it communicates with the apple server. But the problem is, the notifications are queued in the apple server and it doesn't send any notification to the device.
In server side, they are using C# for push notification services and they have traced the value in that method "service.QueueNotification(alertNotification)". So always the notifications are in the QUEUE and it doesn't send any notification to the device.
I have solved the issue, i am testing the notification in the adhoc mode. The problem is, my developer account was expired so that the notification always in the queue from the apple server and it doesn't send any notification to the device. After that i have used some different valid accounts and it work's fine now.
Thanks!

Categories