DotNetBrightener.PushNotification 2026.0.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.PushNotification --version 2026.0.2
                    
NuGet\Install-Package DotNetBrightener.PushNotification -Version 2026.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetBrightener.PushNotification" Version="2026.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetBrightener.PushNotification" Version="2026.0.2" />
                    
Directory.Packages.props
<PackageReference Include="DotNetBrightener.PushNotification" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotNetBrightener.PushNotification --version 2026.0.2
                    
#r "nuget: DotNetBrightener.PushNotification, 2026.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotNetBrightener.PushNotification@2026.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotNetBrightener.PushNotification&version=2026.0.2
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.PushNotification&version=2026.0.2
                    
Install as a Cake Tool

DotNetBrightener Push Notification Library

Copyright © 2017 - 2026 Vampire Coder (formerly DotnetBrightener)

A comprehensive push notification library for .NET applications that supports multiple providers including Apple Push Notification service (APNs) and Firebase Cloud Messaging (FCM).

Features

  • Multi-Provider Support: Seamlessly integrate with APNs and FCM
  • Dependency Injection: Built-in DI support with configuration builders
  • Subscription Management: Handle user device subscriptions with pluggable repositories
  • Async/Await: Full async support for high-performance applications
  • Logging: Comprehensive logging with Microsoft.Extensions.Logging
  • Error Handling: Robust error handling and retry mechanisms
  • Platform Detection: Automatic provider selection based on device platform

Quick Start

1. Installation

Install the required packages:

# Core library
dotnet add package DotNetBrightener.PushNotification

# Dependency injection support
dotnet add package DotNetBrightener.PushNotification.DependencyInjection

# Provider packages
dotnet add package DotNetBrightener.PushNotification.APN
dotnet add package DotNetBrightener.PushNotification.FirebaseIntegration

2. Configuration

Add the following to your appsettings.json:

{
  "PushNotification": {
    "Apple": {
      "TeamId": "YOUR_TEAM_ID",
      "KeyId": "YOUR_KEY_ID",
      "PrivateKey": "YOUR_BASE64_ENCODED_PRIVATE_KEY",
      "BundleId": "com.yourcompany.yourapp",
      "UseSandbox": true
    },
    "Firebase": {
      "ProjectId": "your-firebase-project-id",
      "ServiceKey": "YOUR_FIREBASE_SERVICE_ACCOUNT_JSON",
      "SenderId": "your-sender-id",
      "EnableForIos": false
    }
  }
}

3. Service Registration

In your Program.cs or Startup.cs:

using Microsoft.Extensions.DependencyInjection;

// Register push notification services
builder.Services.AddPushNotification(builder.Configuration)
    .AddApplePushNotification(builder.Configuration)
    .AddFirebaseCloudMessaging(builder.Configuration);

4. Basic Usage

public class NotificationController : ControllerBase
{
    private readonly IPushNotificationService _pushNotificationService;

    public NotificationController(IPushNotificationService pushNotificationService)
    {
        _pushNotificationService = pushNotificationService;
    }

    [HttpPost("send")]
    public async Task<IActionResult> SendNotification([FromBody] SendNotificationRequest request)
    {
        var payload = new PushNotificationPayload
        {
            Title = request.Title,
            Body = request.Body,
            Data = request.CustomData
        };

        await _pushNotificationService.DeliverNotificationToUsers(request.UserIds, payload);
        
        return Ok();
    }

    [HttpPost("subscribe")]
    public async Task<IActionResult> Subscribe([FromBody] SubscribeRequest request)
    {
        var subscription = new PushNotificationSubscription
        {
            UserId = request.UserId,
            DeviceToken = request.DeviceToken,
            DevicePlatform = request.Platform // "ios", "android", "web"
        };

        await _pushNotificationService.RegisterSubscriptionAsync(subscription);
        
        return Ok();
    }
}

Advanced Configuration

Custom Subscription Repository

By default, the library uses an in-memory subscription repository. For production use, implement your own:

public class DatabaseSubscriptionRepository : IPushNotificationSubscriptionRepository
{
    // Implement methods to store subscriptions in your database
}

// Register your custom repository
builder.Services.AddPushNotification(builder.Configuration)
    .UseSubscriptionRepository<DatabaseSubscriptionRepository>()
    .AddApplePushNotification(builder.Configuration)
    .AddFirebaseCloudMessaging(builder.Configuration);

Configuration via Code

You can also configure providers programmatically:

builder.Services.AddPushNotification()
    .AddApplePushNotification(options =>
    {
        options.TeamId = "YOUR_TEAM_ID";
        options.KeyId = "YOUR_KEY_ID";
        options.PrivateKey = "YOUR_PRIVATE_KEY";
        options.BundleId = "com.yourcompany.yourapp";
        options.UseSandbox = false;
    })
    .AddFirebaseCloudMessaging(options =>
    {
        options.ProjectId = "your-project-id";
        options.ServiceKey = "your-service-key-json";
        options.SenderId = "your-sender-id";
    });

Next Steps

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on DotNetBrightener.PushNotification:

Package Downloads
DotNetBrightener.PushNotification.APN

Package Description

DotNetBrightener.PushNotification.FirebaseIntegration

Package Description

DotNetBrightener.PushNotification.DependencyInjection

A library that helps configuring DotNetBrightener.PushNotification in ASP.Net Core applications with minimal efforts

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.0.3-preview-777 123 5/20/2026
2026.0.3-preview-773 124 4/24/2026
2026.0.3-preview-772 123 4/3/2026
2026.0.3-preview-770 119 4/2/2026
2026.0.3-preview-769 122 4/2/2026
2026.0.2 132 4/2/2026
2026.0.2-preview-v2026-0-1-755 126 3/27/2026
2026.0.2-preview-759 117 4/1/2026
2026.0.2-preview-758 121 3/29/2026
2026.0.2-preview-757 123 3/29/2026
2026.0.2-preview-756 121 3/27/2026
2026.0.2-preview-754 110 3/27/2026
2026.0.1 119 3/27/2026
2026.0.1-preview-752 116 3/26/2026
2026.0.1-preview-750 114 3/26/2026
2026.0.1-preview-749 114 3/25/2026
2025.0.11-preview-776 126 5/20/2026
2025.0.11-preview-771 130 4/2/2026
2025.0.11-preview-768 135 4/2/2026
2025.0.11-preview-762 133 4/2/2026
Loading failed