com.AppAmbit.PushNotifications
3.0.0
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
<PackageReference Include="com.AppAmbit.PushNotifications" Version="3.0.0" />
<PackageVersion Include="com.AppAmbit.PushNotifications" Version="3.0.0" />
<PackageReference Include="com.AppAmbit.PushNotifications" />
paket add com.AppAmbit.PushNotifications --version 3.0.0
#r "nuget: com.AppAmbit.PushNotifications, 3.0.0"
#:package com.AppAmbit.PushNotifications@3.0.0
#addin nuget:?package=com.AppAmbit.PushNotifications&version=3.0.0
#tool nuget:?package=com.AppAmbit.PushNotifications&version=3.0.0
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.jsonmatching yourApplicationId(package name). - CocoaPods installed to restore the local
AppAmbitPushNotificationspod when building for iOS. - For background delivery, send FCM with high priority (
priority: "high"in legacy orandroid.priority: "HIGH"in HTTP v1). Do not putpriorityinsidedata.
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.
Local development: the project looks for the locally cloned iOS workspace and automatically restores the pod when
../appambit-sdk-ios/Push/AppAmbitPushNotificationsexists. From the MAUI repo root run:dotnet build push/AppAmbit.PushNotifications/AppAmbit.PushNotifications.csprojCocoaPods uses the spec at
appambit-sdk-ios/Push/AppAmbitPushNotifications/AppAmbitPushNotifications.podspecand compiles the Swift sources directly.Publishing to CocoaPods: once
AppAmbitPushNotificationslives onhttps://cocoapods.org, build the MAUI library with:dotnet build push/AppAmbit.PushNotifications/AppAmbit.PushNotifications.csproj /p:AppAmbitPushNotificationsPodSource=Clearing
AppAmbitPushNotificationsPodSourceforces thePodReferenceto 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 | Versions 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. |
-
net10.0
- com.AppAmbit.Sdk (>= 3.0.0)
-
net10.0-android36.0
- com.AppAmbit.Sdk (>= 3.0.0)
- Xamarin.Firebase.Messaging (>= 123.2.1)
-
net10.0-ios26.0
- com.AppAmbit.Sdk (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.