push notification in Xamarin.forms PCL - push-notification

I need to implement push notification in xamarin.forms project.
I go through these links but cannot find a good sample code.
How to approach push notifications on Xamarin.Forms project?
Add push notifications to your Xamarin.Forms app
Xamarin Push Notifications Using Azure Notifications Hub
implemented Push Notifications in awesome Xamarin.Forms
Most of sample is using azure service. I do not use that one. The back end team will manage to send notification to device. I just need to pass token of notification and handle the given notification at my end.
I got one plugin for Push Notification but cannot find a sample or some useful code for how to use or implement it.
xamarin-plugins for PushNotification

Related

VS 2022 Xamarin.Forms Firebase Cloud Messaging working example

Trying to add Push Notifications to my Xamarin.Forms app, and cannot find any working example to implement Firebase Cloud Messaging.
I mean, not a single working example of all the examples/tutorials.
Can you point me to one, please?
You can first check document Firebase Cloud Messaging. This article provides an overview of how FCM works, and it explains how to configure Google Services so that your app can use FCM.
The implementation process in xamarin android is similar to that on xamarin forms.
You can also find more tutorials in your browser.
For example:
Implement Push Notifications with Xamarin.Forms (Android) and FCM
and
Implement Push Notifications with Xamarin.Forms (iOS) and FCM .

Push Notification on Web view app using Xamarin and Firebase

How can I send push notification to a web view application using Xamarin and Firebase Cloud Messaging?
To add push notification ability to your app ,you have to implement it in each platform project:
For Android, please read the document, there are detailed steps about how to implement remote Notifications with Firebase Cloud Messaging.
For iOS, You can use Xamarin.Firebase.iOS.CloudMessaging to send iOS push notification by FCM.
There are also steps here: Firebase Cloud Messaging on iOS

Use Azure Notifications Hub with Firebase and iOS (not APNS)

I am looking at using Azure Notifications Hub for device registrations on the backend. I was thinking about using Firebase to handle both Android and iOS as it has the capabilities of doing that. I am using ionic so would be using the firebase plugin.
Is it possible to send pus notifications from Azure Notifications Hub to iOS through firebase or does it have to only go through APNS?
Azure Notification Hubs sends Android Notifications through FCM and macOS/iOS notifications through the Apple Push Notification service (APNs).
Azure Notification Hubs has not been tested sending APNS notifications through Firebase Cloud Messaging (FCM); it's not a supported configuration.
If you don't mind me asking, what is it about FCM that makes you want to send Apple notifications through it? All that does is add an extra layer of complexity on top of something ANH already does quite well.
#AndySousa I answered your Azure Forums question on the same topic - copying the response here:
I'm trying to get a blog post published on this, but for Ionic 4 here's what I learned:
The Ionic team made a lot of changes to the framework plus released Capacitor, their alternative for Apache Cordova. Capacitor still supports Apache Cordova, but only a subset of the existing plugins. Ionic also built many common plugins into Capacitor, so you no longer ‘need’ Cordova plugins to deliver certain functionality to your app.
One example of this is the Capacitor Push Notifications plugin which adds support for registering for and processing push notifications to Capacitor. If you follow the procedure to create an Ionic 4 project, add the cordova-azure-notification-hubs plugin to it, and add the code that registers for and processes notifications like you did for Ionic 3 applications, you’ll find that your application registers successfully, but never ‘receives’ any notifications.
What’s happening is that the cordova-azure-notification-hubs plugin is properly managing the registration process with Azure Notification Hubs, but the Capacitor Push Notifications plugin intercepts all notifications that arrive on the device, circumventing the Azure Notification Hubs SDK.
This means that to automatically register for and receive notifications, your Ionic 4 application must use both plugins. The cordova-azure-notification-hubs plugin to manage automatic registration, and the Capacitor Push Notifications plugin to process them when they arrive. Special thanks to Matthew Podwysocki (Microsoft) and Mike Hartington (Ionic) for figuring this one out.
We created a sample application (https://github.com/Azure/azure-notificationhubs-samples/tree/master/Ionic/ionic-4) that shows how to use the plugin in an Ionic 4 app. The sample implements the same Ionic Provider for Azure Notification Hubs that manages registration, but adds additional code to use the Capacitor Push Notifications plugin to process received notifications. With that in place, it’s basically the same UI and logic as the Ionic 3 sample (updated for changes in Ionic 4).
The Capacitor Push plugin also supports a similar registration event listener you can use to grab the device push token and send it to your app backend for Azure Notification Hubs registration. Doing this eliminates the need to use the cordova-azure-notification-hubs plugin in your Capacitor application.
Note: The sample app I reference here is provided for educational purposes, we do not provide Ionic support.

How to Send Push Notification from Xamarin Form app?

Hi I am new to Xamarin forms App development. I recently set up Push Notifications through App center & Firebase. This allows me to send push notifications through their console. However Is there Library or Nuget Package By which I can send These Push notifications through .NET? i.e Send a push notification through my C# Code.
Preferably not using Web Request etc.
This is broad question. We can't provide you exact solution. I have collected all the Proper Links these should get you Setup your App Center and your Xamarin Forms Apps. Please follow the instruction throughly.
Configure App Center Push Server :
As you said, You have already setup the App Center to send push notification. I hope you setup all the instruction correctly otherwise use the following link to read more in details :
iOS : https://learn.microsoft.com/en-us/appcenter/sdk/push/ios
Android : https://learn.microsoft.com/en-us/appcenter/sdk/push/android
Configure your Forms App:
To Setup your Xamarin forms app to receive the Push notification. Please following the following :
https://learn.microsoft.com/en-us/appcenter/sdk/push/xamarin-forms
Send/Subscribe/UnSubscribe the Push notification:
You can call the App Center Push notification API which will send the push notification to specified Device or to the group of devices.
Please go through the following link to learn more about App Center Push API's:
https://learn.microsoft.com/en-us/appcenter/push/pushapi
Let me know; If you stuck on specific problem.

SDK for creating Push Notification for Xamarin Forms

newbie here. I was doing some research on using Xamarin Forms for Push Notification. Understand there are APN (Apple Push Notification), FCM(Google) and WNS (Microsoft). However, I could not understand the iOS App rule on using Push Notification:
1) Push Notifications
https://developer.apple.com/app-store/review/guidelines/2016-06-13/
1.1) Apps that provide Push Notifications without using the Apple Push Notification (APN) API will be rejected
1.2) Apps that use the APN service without obtaining a Push Application ID from Apple will be rejected
what if I use FCM ?
2) What is the SDK for Xamarin forms to build a push notification app which will doing the registration and interacting with app back-end?
What is the best approach for Xamarin Forms?
Thanks
Apple Push Notification Service or (APNS) is the only one who can send push notifications to an iOS device. This is why we provision our app with the proper certificate.
The same applies to FCM or WNS. However, services like Amazon Simple Notification Service (AWS SNS), wrap around all three providers and allow us to make one simple API call to recieve notifications from all 3 providers.
For example, we then provide our certificate that Apple provides us to authorize SNS to send a notification to APNS on our behalf. Push notifications are usually device/platform specific.
AWS SNS Xamarin SDK documentation has good pointers : http://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/sns.html
This is a Xamarin.Forms Github example for the AWS SNS service.

Resources