Dela via


Azure Notification Hubs libraries for .NET

Azure Notification Hubs provide an easy-to-use, multi-platform, scaled-out push engine. With a single cross-platform API call, you can easily send targeted and personalized push notifications to any mobile platform from any cloud or on-premises backend.

Client library

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Note

The Azure Notification Hubs NuGet package now supports .NET Standard, which allows using .NET core for backend use of Notifications Hubs

Visual Studio Package Manager

Install-Package Microsoft.Azure.NotificationHubs
dotnet add package Microsoft.Azure.NotificationHubs

Code Example

This example connects to a Notification Hub and sends a Windows Push Notification Service (WNS) message.

NotificationHubClient hub = NotificationHubClient
                                .CreateClientFromConnectionString("<connection string with full access>", "<hub name>");
string toast = @"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello from a .NET App!</text></binding></visual></toast>";
await hub.SendWindowsNativeNotificationAsync(toast);

Management library

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio Package Manager

Install-Package Microsoft.Azure.Management.NotificationHubs
dotnet add package Microsoft.Azure.Management.NotificationHubs

Samples