com.AppAmbit.PushNotifications 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package com.AppAmbit.PushNotifications --version 3.0.0
                    
NuGet\Install-Package com.AppAmbit.PushNotifications -Version 3.0.0
                    
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="com.AppAmbit.PushNotifications" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="com.AppAmbit.PushNotifications" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="com.AppAmbit.PushNotifications" />
                    
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 com.AppAmbit.PushNotifications --version 3.0.0
                    
#r "nuget: com.AppAmbit.PushNotifications, 3.0.0"
                    
#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 com.AppAmbit.PushNotifications@3.0.0
                    
#: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=com.AppAmbit.PushNotifications&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=com.AppAmbit.PushNotifications&version=3.0.0
                    
Install as a Cake Tool

AppAmbit Push Notifications SDK (MAUI / Android)

Seamlessly integrate push notifications with your AppAmbit analytics.

Extension of the core AppAmbit MAUI SDK for handling Firebase Cloud Messaging (FCM). Supports both Android and iOS (via the AppAmbitPushNotifications CocoaPod).


Contents


Features

  • Simple setup after the core SDK.
  • Enable/disable notifications at business + FCM level.
  • Automatically handles standard FCM notification fields (title, body, color, icon, channel_id, click_action, image).
  • Permission helper for POST_NOTIFICATIONS (Android 13+).
  • Optional hook to fully customize the notification.

Requirements

  • .NET 8/9 MAUI targeting Android API 21+ and iOS 12+.
  • Packages:
    • com.AppAmbit.SdkMaui (core)
    • AppAmbit.PushNotifications
  • Firebase project + google-services.json matching your ApplicationId (package name).
  • CocoaPods installed to restore the local AppAmbitPushNotifications pod when building for iOS.
  • For background delivery, send FCM with high priority (priority: "high" in legacy or android.priority: "HIGH" in HTTP v1). Do not put priority inside data.

Install

dotnet add package com.AppAmbit.SdkMaui
dotnet add package AppAmbit.PushNotifications

Add Firebase config to your MAUI project file and place the file under Platforms/Android/:

<GoogleServicesJson Include="Platforms/Android/google-services.json" />

Quickstart

MAUI

MauiProgram.cs

using AppAmbit;

var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp<App>()
    .UseAppAmbit("<YOUR-APPKEY>");

Platforms/Android/MainActivity.cs

using AppAmbit.PushNotifications;
using AndroidX.Activity;

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    PushNotifications.Start(ApplicationContext);
    PushNotifications.RequestNotificationPermission((ComponentActivity)this);
}

.NET Android (native Activity)

using AppAmbitMaui; // core SDK
using AppAmbit.PushNotifications;
using AndroidX.AppCompat.App;

[Activity(Theme = "@style/Theme.AppCompat.Light.NoActionBar", MainLauncher = true)]
public class MainActivity : AppCompatActivity
{
    protected override void OnCreate(Bundle? savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        AppAmbitSdk.Start("<YOUR-APPKEY>");

        PushNotifications.Start(ApplicationContext);
        PushNotifications.RequestNotificationPermission(this);
    }
}

Usage

Enable/Disable & Status

// Disable (updates backend + deletes FCM token)
PushNotifications.SetNotificationsEnabled(ctx, false);

// Enable again
PushNotifications.SetNotificationsEnabled(ctx, true);

// Query current setting
bool enabled = PushNotifications.IsNotificationsEnabled(ctx);

Permission listener (optional)

class PermissionListener : Java.Lang.Object, PushNotifications.IPermissionListener
{
    public void OnPermissionResult(bool granted) =>
        System.Diagnostics.Debug.WriteLine($"Push permission: {granted}");
}

PushNotifications.RequestNotificationPermission(activity, new PermissionListener());

Customization

The SDK already applies standard FCM fields. For advanced scenarios, register a customizer and use keys from your data payload to change the notification.

class Customizer : Java.Lang.Object, PushNotifications.INotificationCustomizer
{
    public void Customize(Context ctx, NotificationCompat.Builder b, AppAmbitNotification n)
    {
        b.SetColor(Android.Graphics.Color.ParseColor("#0066FF"));

        // Example: add an action from custom data keys
        if (n.Data.TryGetValue("action_intent", out var action) &&
            n.Data.TryGetValue("action_title", out var title))
        {
            var intent = new Intent(action);
            var pending = PendingIntent.GetBroadcast(
                ctx, 0, intent,
                PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable);
            b.AddAction(0, title, pending);
        }
    }
}

PushNotifications.SetNotificationCustomizer(new Customizer());

Send any custom keys you need in data; AppAmbitNotification.Data exposes the full map.

iOS (CocoaPods) integration (local → remote workflow)

The MAUI push package now builds for both Android and iOS. The iOS target consumes the AppAmbitPushNotifications CocoaPod.

  1. Local development: the project looks for the locally cloned iOS workspace and automatically restores the pod when ../appambit-sdk-ios/Push/AppAmbitPushNotifications exists. From the MAUI repo root run:

    dotnet build push/AppAmbit.PushNotifications/AppAmbit.PushNotifications.csproj
    

    CocoaPods uses the spec at appambit-sdk-ios/Push/AppAmbitPushNotifications/AppAmbitPushNotifications.podspec and compiles the Swift sources directly.

  2. Publishing to CocoaPods: once AppAmbitPushNotifications lives on https://cocoapods.org, build the MAUI library with:

    dotnet build push/AppAmbit.PushNotifications/AppAmbit.PushNotifications.csproj /p:AppAmbitPushNotificationsPodSource=
    

    Clearing AppAmbitPushNotificationsPodSource forces the PodReference to fetch the pod from the public spec repo (you can still pin a version via your consuming app’s Podfile).

The iOS PushNotifications wrapper forwards the native facade (start(), setNotificationsEnabled(_:), isNotificationsEnabled() and requestNotificationPermission()) so the public C# API matches Android while CocoaPods handles the Swift dependency.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  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
4.0.1 46 6/5/2026
4.0.0 87 6/2/2026
3.1.0 104 4/15/2026
3.0.0 114 3/23/2026
2.1.0 108 3/4/2026