Omnicasa.Maui.PostHog.Android
2026.8.10.7
dotnet add package Omnicasa.Maui.PostHog.Android --version 2026.8.10.7
NuGet\Install-Package Omnicasa.Maui.PostHog.Android -Version 2026.8.10.7
<PackageReference Include="Omnicasa.Maui.PostHog.Android" Version="2026.8.10.7" />
<PackageVersion Include="Omnicasa.Maui.PostHog.Android" Version="2026.8.10.7" />
<PackageReference Include="Omnicasa.Maui.PostHog.Android" />
paket add Omnicasa.Maui.PostHog.Android --version 2026.8.10.7
#r "nuget: Omnicasa.Maui.PostHog.Android, 2026.8.10.7"
#:package Omnicasa.Maui.PostHog.Android@2026.8.10.7
#addin nuget:?package=Omnicasa.Maui.PostHog.Android&version=2026.8.10.7
#tool nuget:?package=Omnicasa.Maui.PostHog.Android&version=2026.8.10.7
Maui.Posthog
.NET MAUI bindings for the native PostHog SDKs, with a single cross-platform façade.
| Platform | Native SDK | Version |
|---|---|---|
Android (net10.0-android) |
com.posthog:posthog-android (+ com.posthog:posthog 6.29.0) |
3.58.0 |
iOS (net10.0-ios) |
posthog-ios (PostHog.xcframework) |
3.69.3 |
Features: event capture, feature flags, session replay, autocapture / screen views.
Projects
src/
Maui.Posthog.Android/ Java binding of posthog-android (+ curtains, posthog core)
Maui.Posthog.iOS/ ObjC binding of PostHog.xcframework (built from source)
Maui.Posthog/ Shared IPostHog façade + DI (net10.0-ios;net10.0-android)
samples/
Maui.Posthog.Sample/ Minimal MAUI app wiring AddPostHog
Usage
Register in MauiProgram:
builder.AddPostHog(options =>
{
options.ApiKey = "phc_your_project_key";
options.Host = "https://eu.i.posthog.com"; // or https://us.i.posthog.com
options.CaptureScreenViews = true;
options.Autocapture = true; // iOS UI element interactions
options.SessionReplay = true;
options.Replay.MaskAllTextInputs = true;
});
Then inject IPostHog anywhere:
public class HomeViewModel(IPostHog posthog)
{
public void OnPurchase() =>
posthog.Capture("purchase", new Dictionary<string, object>
{
["plan"] = "pro",
["amount"] = 49.0,
});
}
IPostHog surface: Capture, Identify, Screen, Alias, Group, IsFeatureEnabled,
GetFeatureFlag, GetFeatureFlagPayload, ReloadFeatureFlags, Register/Unregister,
DistinctId, Reset, Flush, OptIn/OptOut, StartSessionReplay/StopSessionReplay.
Overriding behavior
PostHogService is public on each platform and every member is virtual. Subclass it
(under Platforms/iOS or Platforms/Android), override what you need, call base to keep the
native behavior, and register your type:
public class MyPostHog : PostHogService
{
public MyPostHog(PostHogOptions options) : base(options) { }
public override void Capture(string eventName, IDictionary<string, object>? properties = null)
{
properties ??= new Dictionary<string, object>();
properties["app_build"] = AppInfo.BuildString;
base.Capture(eventName, properties); // Client is available via the protected property
}
}
// register the subclass:
builder.AddPostHog<MyPostHog>(o => o.ApiKey = "phc_your_project_key");
Rebuilding the iOS xcframework
PostHog.xcframework under src/Maui.Posthog.iOS/ is prebuilt from posthog-ios 3.69.3.
To regenerate against a newer tag, clone the source into scripts/posthog-ios
(git clone --depth 1 --branch <tag> https://github.com/PostHog/posthog-ios.git scripts/posthog-ios)
and run scripts/build-xcframework.sh; it archives the PostHog scheme for device + simulator with
BUILD_LIBRARY_FOR_DISTRIBUTION=YES, runs xcodebuild -create-xcframework, and strips the
vendored scripts Apple rejects in embedded frameworks. Copy the result over
src/Maui.Posthog.iOS/PostHog.xcframework, then diff the regenerated
Headers/PostHog-Swift.h against the previous one and update the binding surface in
src/Maui.Posthog.iOS/ApiDefinition.cs.
Notes
- iOS binds the
@objcsurface of the Swift SDK.PostHogSDKkeeps its mangled Swift runtime name (_TtC7PostHog10PostHogSDK);PostHogConfig/PostHogSessionReplayConfiguse clean names. - Android reaches the Kotlin
PostHogAndroidcompanion via a small JNI shim (Additions/PostHogAndroid.cs) because the generator does not surface generic companion methods. - Android apps need
SupportedOSPlatformVersion24 or higher: this binding targets 24, andposthog-android's own manifest requires at least 23, so a lower minSdk fails the manifest merge. Transforms/Metadata.xmlwidensPostHogStateless.getConfig()to public (C# can't narrow access on an override) and drops the twocom.posthog.internalGson deserializers, whose genericJsonDeserializer<T>can't satisfyIJsonDeserializer.Deserialize.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. |
-
net10.0-android36.0
- GoogleGson (>= 2.13.2)
- Square.OkHttp3 (>= 4.12.0.6)
- Xamarin.AndroidX.Core (>= 1.16.0.1)
- Xamarin.AndroidX.Lifecycle.Common.Java8 (>= 2.9.4)
- Xamarin.AndroidX.Lifecycle.Process (>= 2.9.4)
- Xamarin.Kotlin.StdLib (>= 2.2.20)
- Xamarin.Kotlin.StdLib.Jdk8 (>= 2.2.20)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Omnicasa.Maui.PostHog.Android:
| Package | Downloads |
|---|---|
|
Omnicasa.Maui.PostHog
.NET MAUI bindings for the native PostHog SDKs (iOS + Android): event capture, feature flags, session replay, and autocapture behind a single IPostHog facade. Reference this package. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.8.10.7 | 210 | 8/10/2026 |
| 2026.7.20.6 | 147 | 7/20/2026 |
| 2026.7.20.5 | 109 | 7/20/2026 |
| 2026.7.17.4 | 118 | 7/17/2026 |
| 2026.7.17.3 | 114 | 7/17/2026 |
| 2026.7.17.2 | 115 | 7/17/2026 |
| 2026.7.17.1 | 107 | 7/17/2026 |
| 1.0.0 | 121 | 7/16/2026 |