Indiko.Blocks.Messaging.PushNotification 2.1.1

dotnet add package Indiko.Blocks.Messaging.PushNotification --version 2.1.1
                    
NuGet\Install-Package Indiko.Blocks.Messaging.PushNotification -Version 2.1.1
                    
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="Indiko.Blocks.Messaging.PushNotification" Version="2.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Indiko.Blocks.Messaging.PushNotification" Version="2.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Indiko.Blocks.Messaging.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 Indiko.Blocks.Messaging.PushNotification --version 2.1.1
                    
#r "nuget: Indiko.Blocks.Messaging.PushNotification, 2.1.1"
                    
#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 Indiko.Blocks.Messaging.PushNotification@2.1.1
                    
#: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=Indiko.Blocks.Messaging.PushNotification&version=2.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Indiko.Blocks.Messaging.PushNotification&version=2.1.1
                    
Install as a Cake Tool

Indiko.Blocks.Messaging.PushNotification

Push notification messaging implementation for sending notifications to mobile devices (iOS, Android, Web).

Overview

This package provides push notification capabilities for mobile and web applications with support for multiple platforms.

Features

  • Multi-Platform: iOS (APNs), Android (FCM), Web Push
  • Batch Sending: Send to multiple devices
  • Data Payloads: Custom data with notifications
  • Badge/Sound: Badge counts and custom sounds
  • Template Support: Message templates
  • Delivery Tracking: Track notification delivery

Installation

dotnet add package Indiko.Blocks.Messaging.PushNotification

Configuration

appsettings.json

{
  "PushNotificationOptions": {
    "Enabled": true,
    "Provider": "Firebase",
    "FirebaseServerKey": "your-firebase-server-key",
    "FirebaseProjectId": "your-project-id",
    "ApnsCertificatePath": "path/to/apns-cert.p12",
    "ApnsCertificatePassword": "cert-password",
    "ApnsUseSandbox": false
  }
}

Quick Start

Send to Single Device

public class NotificationService
{
    private readonly IPushNotificationSender _notificationSender;

    public async Task SendWelcomeNotificationAsync(string deviceToken)
    {
        var notification = new PushNotificationMessage
        {
            DeviceTokens = new[] { deviceToken },
            Title = "Welcome!",
            Body = "Thanks for installing our app.",
            Data = new Dictionary<string, string>
            {
                { "type", "welcome" },
                { "screen", "home" }
            }
        };

        var result = await _notificationSender.SendAsync(notification);
        
        if (!result.Success)
        {
            _logger.LogError($"Failed to send notification: {result.ErrorMessage}");
        }
    }
}

Send to Multiple Devices

public async Task NotifyAllUsersAsync(string title, string message)
{
    var deviceTokens = await _userRepository.GetAllDeviceTokensAsync();
    
    var notification = new PushNotificationMessage
    {
        DeviceTokens = deviceTokens.ToArray(),
        Title = title,
        Body = message,
        Data = new Dictionary<string, string>
        {
            { "broadcast", "true" },
            { "timestamp", DateTime.UtcNow.ToString() }
        }
    };

    await _notificationSender.SendAsync(notification);
}

iOS-Specific Features

var notification = new PushNotificationMessage
{
    DeviceTokens = new[] { iosDeviceToken },
    Title = "New Message",
    Body = "You have a new message from John",
    Badge = 5,  // Badge count
    Sound = "notification.wav",  // Custom sound
    Data = new Dictionary<string, string>
    {
        { "messageId", "12345" },
        { "senderId", "user-789" }
    }
};

Android-Specific Features

var notification = new PushNotificationMessage
{
    DeviceTokens = new[] { androidDeviceToken },
    Title = "Order Update",
    Body = "Your order has been shipped!",
    Data = new Dictionary<string, string>
    {
        { "orderId", order.Id.ToString() },
        { "trackingNumber", order.TrackingNumber },
        { "priority", "high" },
        { "clickAction", "ORDER_DETAILS" }
    }
};

Platform Setup

Firebase Cloud Messaging (FCM)

  1. Create Firebase project
  2. Get Server Key from Firebase Console
  3. Configure in appsettings.json

Apple Push Notification Service (APNs)

  1. Create APNs certificate in Apple Developer Portal
  2. Export as .p12 file
  3. Configure certificate path and password

Web Push

  1. Generate VAPID keys
  2. Configure public/private keys
  3. Add service worker to web app

Best Practices

  1. Token Management: Keep device tokens updated
  2. Error Handling: Handle invalid/expired tokens
  3. Delivery Reports: Track delivery status
  4. Rate Limiting: Respect platform limits
  5. Batching: Batch notifications for efficiency
  6. Testing: Test on real devices
  7. User Preferences: Respect notification preferences

Target Framework

  • .NET 10

Dependencies

  • Indiko.Blocks.Messaging.Abstractions
  • Platform-specific SDKs (Firebase, APNs)
  • Indiko.Blocks.Messaging.AzureNotificationHub
  • Indiko.Blocks.Messaging.Abstractions
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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 305 12/2/2025
2.1.0 313 12/2/2025
2.0.0 299 9/17/2025
1.7.23 322 9/8/2025
1.7.22 174 9/8/2025
1.7.21 178 8/14/2025
1.7.20 215 6/23/2025
1.7.19 175 6/3/2025
1.7.18 182 5/29/2025
1.7.17 179 5/26/2025
1.7.15 133 4/12/2025
1.7.14 155 4/11/2025
1.7.13 151 3/29/2025
1.7.12 153 3/28/2025
1.7.11 161 3/28/2025
1.7.10 156 3/28/2025
1.7.9 158 3/28/2025
1.7.8 164 3/28/2025
1.7.5 190 3/17/2025
1.7.4 168 3/16/2025
1.7.3 179 3/16/2025
1.7.2 164 3/16/2025
1.7.1 205 3/11/2025
1.7.0 192 3/11/2025
1.6.8 203 3/11/2025
1.6.7 252 3/4/2025
1.6.6 148 2/26/2025
1.6.5 161 2/20/2025
1.6.4 143 2/20/2025
1.6.3 158 2/5/2025
1.6.2 130 1/24/2025
1.6.1 132 1/24/2025
1.6.0 131 1/16/2025
1.5.2 135 1/16/2025
1.5.1 162 11/3/2024
1.5.0 155 10/26/2024
1.3.2 145 10/24/2024
1.3.0 142 10/10/2024
1.2.5 156 10/9/2024
1.2.4 157 10/8/2024
1.2.1 153 10/3/2024
1.2.0 142 9/29/2024
1.1.1 147 9/23/2024
1.1.0 164 9/18/2024
1.0.33 167 9/15/2024