integration-android

Integrate PostHog analytics into Android apps with event tracking and error monitoring.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill integration-android
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-android
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/integration/skills/android
Command: npx skills add https://github.com/PostHog/skills --skill integration-android

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Android apps often lack a unified analytics layer, making it difficult to understand user flows, identify issues, and measure health metrics. This Skill provides a streamlined path to integrate PostHog analytics, identify users, track events, and monitor errors within Android projects.

Core Features & Use Cases

  • Seamless initialization: Initialize PostHog in Application.onCreate() with safe config and environment-based keys.
  • User identification & events: Identify users on login and capture meaningful events to tie user actions to profiles.
  • Error tracking & screen views: Enable automatic error tracking and screen view analytics, including session replay enhancements when enabled.

Quick Start

Initialize PostHog early in your Application.onCreate() and configure it with your API key and host, following the example code in this skill.

Frequently Asked Questions about integration-android

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add PostHog analytics to an Android app?

To add PostHog analytics to an Android app, initialize the SDK in Application.onCreate() using PostHogAndroidConfig and PostHogAndroid.setup, then configure event tracking and user identification. This wires up analytics directly into your Kotlin or Java project.

Can I use PostHog error tracking and session replay in Android?

Yes, PostHog error tracking and session replay work in Android by enabling them during SDK initialization. Configuring PostHogAndroidConfig allows you to automatically monitor errors and capture screen view analytics for your application.

What is the best way to configure PostHog API keys in Android?

The best way to configure PostHog API keys in Android is by using environment-based variables. You should avoid hardcoding keys directly in your source code to maintain security and follow safe configuration practices.

Does PostHog Android integration support both Kotlin and Java projects?

Yes, PostHog Android integration supports both Kotlin and Java projects. The implementation requires initialization in Application.onCreate() and follows standard Android setup patterns to wire up event tracking and user identification.

How do I identify users with PostHog in an Android application?

To identify users with PostHog in an Android application, call the identify method when a user logs in. This ties user actions to their profiles, allowing you to capture meaningful events and understand user flows.

Why should I initialize PostHog in Application.onCreate()?

Initializing PostHog in Application.onCreate() ensures the analytics SDK is configured before any activities run, enabling automatic error tracking and screen view capture throughout your Android app's lifecycle.