Xamarin application not getting registered with Azure Notification Hub

Raihan Iqbal 121 Reputation points
2024-02-13T05:23:08.46+00:00

Hi all, I've been following this guide, albeit a bit outdated, to set up the backend services and register them with Azure Notification Hubs.

Google: Azure automatically verifies the API Key when I click on Save so does that mean I have set up Firebase correctly? User's image

For the project setup, I decided to follow this guide instead as it uses official Nuget packages to handle registration and notifications as opposed to custom code. In my Xamarin application startup app class, I've registered Notification Hub however my emulator doesn't get registered in Azure

public partial class App: Application
{
	public App()
	{
		// Azure Notification Hub
		NotificationHub.Start("Endpoint=sb://....", "My-App-NH");
		NotificationHub.AddTags(new[] { "DeveloperDevices" });
		NotificationHub.NotificationMessageReceived += (sender, args) =>
		{
		    Debug.WriteLine("Message received");
		};
		NotificationHub.InstallationSaved += (sender, e) =>
		{
		    Debug.WriteLine($"Installation ID: {e.Installation.InstallationId} saved successfully");
		};
		NotificationHub.InstallationSaveFailed += (sender, e) =>
		{
		    Debug.WriteLine($"Failed to save installation: {e.Exception.Message}");
		};
	}
}
Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
242 questions
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,254 questions
{count} votes