A lightweight library for sending push notifications to iOS APNs (JWT-based) and Android FCM from .NET.
- .NET 9.0
- .NET 8.0
Note: netstandard targets were removed in recent versions.
Install from NuGet:
dotnet add package DotNet.Push
var apns = new IosPushNotifyAPNs(
teamId: "<team-id>",
bundleAppId: "<bundle-app-id>",
apnsPrivatekeyId: "<key-id>",
apnsPrivateKey: @"<path to AuthKey_XXXXXX.p8>");
var content = new { title = "Json Web Token(JWT)", body = "Apple Push Notification Service(APNs)" };
var result = await apns.JwtAPNsPushAsync(
device_token: "<device-token>",
content: content,
apnsId: Guid.NewGuid().ToString(),
badge: 1,
sound: "ping.aiff");
Console.WriteLine($"APNs: {result.success}, {result.message}");
var fcm = new AosPushNotifyFCM(
serverKey: "<server-api-key>",
serverId: "<server-id>",
alarmTag: "<alarm-tag>");
var result = await fcm.SendNotificationAsync(
deviceToken: "<to>",
priority: "high",
title: "<title>",
clickAction: "<click-action>",
message: "<message>",
badge: 1,
iconName: "<icon-name>",
color: "#ffffff");
Console.WriteLine($"FCM: {result.success}, {result.message}");
See the full example in samples/DotNet.Push.Sample/Program.cs
.
- Ctor:
IosPushNotifyAPNs(string teamId, string bundleAppId, string apnsPrivatekeyId, string apnsPrivateKey, string algorithm = "ES256", bool production = true, int port = 443, int expireMinutes = 60)
- Send:
Task<(bool success, string message)> JwtAPNsPushAsync(string device_token, object content, string apnsId, int badge, string sound, CancellationToken cancellationToken = default)
Required: Apple Team ID, Bundle ID, Key ID, and path to the .p8 private key. Defaults use ES256 and the production server (api.push.apple.com:443
).
- Ctor:
AosPushNotifyFCM(string serverKey, string serverId, string alarmTag)
- Send:
Task<(bool success, string message)> SendNotificationAsync(string deviceToken, string priority, string title, string clickAction, string message, int badge, string iconName, string color)
Required: FCM Server Key and Sender ID. Default endpoint is https://fcm.googleapis.com/fcm/send
.
- Communicating with APNs
- Token Based Authentication and HTTP/2 Example with APNS
- How to make the .NET HttpClient use HTTP/2
- Project Roadmap
- Tasks Board
- Visual Studio 2022
- .NET 8.0 / .NET 9.0 SDK
Local build: run dotnet build
at the solution root.
See LICENSE.md.
See CONTRIBUTING.md.
2025-08-27: TargetFrameworks updated to .NET 8.0, 9.0 (removed netstandard)
2023-11-15: update to .NET 7.0
2020-12-30: update to .NET 5.0
2019-02-17: upgrade .NET Core 2.2 & net462
2018-07-10: upgrade .NET Core 2.1 & downgrade net462
2018-03-29: upgrade .NET Core 2.0 & net47
- Homepage: http://www.odinsoft.co.kr
- Email: [email protected]
See LICENSE.md.
- SEONGAHN - Lead Developer & Project Architect ([email protected])
- YUJIN - Senior Developer & Exchange Integration Specialist ([email protected])
- SEJIN - Software Developer & API Implementation ([email protected])
Built with ❤️ by the ODINSOFT Team | ⭐ Star us on GitHub