{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Products","product_name":"Engage Studio","type":"markdown"},"seo":{"title":"Android Developer Guide","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"android-developer-guide","__idx":0},"children":["Android Developer Guide"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Beta Feature"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mobile Push is currently in beta. Features, APIs, and implementation details may change before general availability."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide provides implementation requirements for integrating Engage Studio Mobile Push notifications in your Android app using the Treasure Data Android SDK. Your development team must implement the following functionality:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["FCM Integration"]},": Receive push notifications via Firebase Cloud Messaging"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Token Management"]},": Register and update device tokens with Treasure Data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Notification Display"]},": Show notifications with images, action buttons, and deep links"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Event Tracking"]},": Track user interactions (delivery, open, dismiss, links) using Treasure Data SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Automated Data Upload"]},": Treasure Data SDK automatically handles event upload to Treasure Data"]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Sample Implementation Available"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A complete, production-ready sample application is available on GitHub:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["Treasure Data Mobile Push - Android Sample"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The sample includes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Complete Firebase Messaging Service implementation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Event tracking with Treasure Data SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Deep link and web link handling"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Notification UI with action buttons and images"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Clone the repository and use it as a reference for your implementation."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":2},"children":["Requirements"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Component"},"children":["Component"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Requirement"},"children":["Requirement"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Minimum Android Version"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Android 8.0 (API 26) or later"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Language"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Kotlin (recommended) or Java"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Required Dependencies"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Firebase Messaging SDK (via Firebase BoM 34.7.0+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Treasure Data Android SDK 1.1.0+"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["WorkManager 2.9.1+ (for background tasks)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Chrome Custom Tabs 1.8.0+ (for web link handling)"]}]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tracked Events"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivery"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink_open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"architecture-overview","__idx":3},"children":["Architecture Overview"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"┌─────────────────────┐\n│   Engage Studio     │\n│     Campaign        │\n└──────────┬──────────┘\n           │\n           ▼\n┌─────────────────────┐\n│ Firebase Cloud      │\n│   Messaging (FCM)   │\n└──────────┬──────────┘\n           │\n           ▼\n┌─────────────────────┐\n│  Your Android App   │\n├─────────────────────┤\n│ MyFirebaseMessaging │ ← Receives notifications\n│      Service        │\n├─────────────────────┤\n│  PushEventReceiver  │ ← Handles user actions\n├─────────────────────┤\n│ Treasure Data SDK   │ ← Tracks and uploads events\n└──────────┬──────────┘\n           │\n           ▼\n┌─────────────────────┐\n│  Treasure Data      │\n│   Ingest API        │\n└─────────────────────┘\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"implementation-components","__idx":4},"children":["Implementation Components"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your Android app must implement the following components:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1-application-class","__idx":5},"children":["1. Application Class"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Purpose:"]}," Initialize Treasure Data SDK and configure app-wide settings"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Responsibilities:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Initialize Treasure Data SDK with API endpoint and database configuration"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Configure automatic data collection settings"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enable debug logging (optional)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference:"]}," See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyApplication.kt"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["sample repository"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2-firebase-messaging-service","__idx":6},"children":["2. Firebase Messaging Service"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Purpose:"]}," Receive and display push notifications from FCM"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Responsibilities:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Listen for incoming FCM messages"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Extract notification payload (title, body, image, links)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Display notification with action buttons"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivery"]}," events using Treasure Data SDK when notification is received"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle FCM token updates"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference:"]}," See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyFirebaseMessagingService.kt"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["sample repository"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"3-push-event-receiver","__idx":7},"children":["3. Push Event Receiver"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Purpose:"]}," Handle user interactions with notifications"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Responsibilities:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle notification tap (main content)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle action button taps (web link, deep link)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Handle notification dismiss"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track corresponding events (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_open"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink_open"]},") using Treasure Data SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open web URLs using Chrome Custom Tabs"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open deep links within the app"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference:"]}," See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PushEventReceiver.kt"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["sample repository"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"4-fcm-token-service","__idx":8},"children":["4. FCM Token Service"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Purpose:"]}," Manage device token registration with Treasure Data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Responsibilities:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Obtain current FCM token"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Register token with Treasure Data when app launches using SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Re-register token when it's refreshed by FCM"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Associate token with user ID when user logs in"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}," events"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference:"]}," See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FcmTokenService.kt"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["sample repository"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"5-mainactivity-integration","__idx":9},"children":["5. MainActivity Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Purpose:"]}," Handle notification taps and deep links"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key Responsibilities:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Receive notification tap intents"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}," events using Treasure Data SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to appropriate screen based on deep link"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open web URLs when specified"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference:"]}," See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MainActivity.kt"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["sample repository"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"data-payload-schema","__idx":10},"children":["Data Payload Schema"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your app will receive the following JSON structure in the FCM ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," payload:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"td_campaign_id\": \"cmp_20251214_promo\",\n  \"title\": \"Special Offer!\",\n  \"body\": \"Get 20% off your next purchase\",\n  \"image_url\": \"https://cdn.example.com/banner.png\",\n  \"link\": \"https://example.com/promo\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td_campaign_id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Unique campaign identifier from Engage Studio"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["title"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Notification title"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["body"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Notification body text"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image_url"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["URL for rich notification image"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["String"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Web URL to open in browser"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-tracking","__idx":11},"children":["Event Tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your app must track the following events and send them to Treasure Data:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Event Type"},"children":["Event Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"When to Track"},"children":["When to Track"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required Fields"},"children":["Required Fields"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivery"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When notification is received and displayed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When user taps the notification"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When user dismisses the notification"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_open"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When user taps a web link"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["value"]}," (URL)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink_open"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When user taps a deep link"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["value"]}," (URI)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When FCM token is obtained or refreshed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fcm_token"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["time"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}," (if logged in)"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All events are automatically sent by the Treasure Data SDK to the configured Treasure Data endpoint. The SDK handles batching, queuing, and retry logic automatically."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/push-events-table"},"children":["Push Events Table"]}," documentation for complete schema details."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration-requirements","__idx":12},"children":["Configuration Requirements"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"androidmanifestxml","__idx":13},"children":["AndroidManifest.xml"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your app must declare:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["INTERNET"]}," permission"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST_NOTIFICATIONS"]}," permission (Android 13+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Firebase Messaging Service"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Broadcast Receiver for notification actions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Deep link intent filters"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"buildgradlekts","__idx":14},"children":["build.gradle.kts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Required dependencies:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Firebase BoM: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["34.7.0"]}," or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Firebase Messaging (version managed by BoM)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Treasure Data Android SDK: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1.1.0"]}," or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["WorkManager: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2.9.1"]}," or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Chrome Custom Tabs: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1.8.0"]}," or later"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example dependency configuration:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"dependencies {\n    // Firebase\n    implementation(platform(\"com.google.firebase:firebase-bom:34.7.0\"))\n    implementation(\"com.google.firebase:firebase-messaging\")\n    implementation(\"com.google.firebase:firebase-analytics\")\n\n    // Treasure Data SDK\n    implementation(\"com.treasuredata:td-android-sdk:1.1.0\")\n\n    // Background tasks\n    implementation(\"androidx.work:work-runtime-ktx:2.9.1\")\n\n    // Web links\n    implementation(\"androidx.browser:browser:1.8.0\")\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"localproperties","__idx":15},"children":["local.properties"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure Treasure Data settings in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," (this file should be excluded from version control):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"properties","header":{"controls":{"copy":{}}},"source":"TD_WRITE_KEY=your_write_api_key_here\nTD_DATABASE=mobile\nTD_TABLE=push_events\nTD_ENDPOINT=https://in.treasuredata.com\n","lang":"properties"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Access these properties in your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["build.gradle.kts"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"val localProperties = Properties()\nlocalProperties.load(FileInputStream(rootProject.file(\"local.properties\")))\n\nandroid {\n    defaultConfig {\n        buildConfigField(\"String\", \"TD_WRITE_KEY\", \"\\\"${localProperties[\"TD_WRITE_KEY\"]}\\\"\")\n        buildConfigField(\"String\", \"TD_DATABASE\", \"\\\"${localProperties[\"TD_DATABASE\"]}\\\"\")\n        buildConfigField(\"String\", \"TD_TABLE\", \"\\\"${localProperties[\"TD_TABLE\"]}\\\"\")\n        buildConfigField(\"String\", \"TD_ENDPOINT\", \"\\\"${localProperties[\"TD_ENDPOINT\"]}\\\"\")\n    }\n}\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"notification-permissions","__idx":16},"children":["Notification Permissions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For Android 13+ (API 33), request ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST_NOTIFICATIONS"]}," permission at runtime."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"user-id-association","__idx":17},"children":["User ID Association"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To link push notification events with specific users:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Logged-in users"]},": Include ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}," (e.g., customer ID, email hash) in all events"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Anonymous users"]},": Pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}," in events"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["On login"]},": Send new ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}," event with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user_id"]}," to associate the device"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Treasure Data will link all previous events from the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["fcm_token"]}," to the user."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"testing","__idx":18},"children":["Testing"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"test-notification-delivery","__idx":19},"children":["Test Notification Delivery"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Run your app on a device with Google Play Services"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check logcat for FCM token"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send test notification from Firebase Console"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify notification appears on device"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"verify-event-tracking","__idx":20},"children":["Verify Event Tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Query Treasure Data to confirm events are being logged:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT\n  time,\n  type,\n  campaign_id,\n  platform\nFROM mobile.push_events\nWHERE platform = 'android'\nORDER BY time DESC\nLIMIT 100\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"security-best-practices","__idx":21},"children":["Security Best Practices"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API Keys"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Never commit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," to source control"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".gitignore"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use write-only keys (not master keys)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Store sensitive configuration in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]},", not in code"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Deep Links"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Always validate deep link destinations"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Implement URL allowlists for sensitive actions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sanitize parameters before navigation"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Event Data"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Do not include PII in event payloads"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use hashed or anonymized user IDs when possible"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Network Security"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Always use HTTPS for API endpoints"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Consider certificate pinning for production"]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"troubleshooting","__idx":22},"children":["Troubleshooting"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"notifications-not-received","__idx":23},"children":["Notifications Not Received"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify FCM token is generated and uploaded"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check Google Play Services is installed and updated"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify notification permissions (Android 13+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-services.json"]}," is in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app/"]}," directory"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"events-not-appearing-in-treasure-data","__idx":24},"children":["Events Not Appearing in Treasure Data"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TD_WRITE_KEY"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," is correct"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TD_ENDPOINT"]}," matches your region"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify database and table exist in Treasure Data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check Treasure Data SDK is properly initialized in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyApplication"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enable debug logging to see SDK activity: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TreasureData.enableLogging()"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"deep-links-not-working","__idx":25},"children":["Deep Links Not Working"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify intent filter in AndroidManifest.xml"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Test with: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb shell am start -W -a android.intent.action.VIEW -d \"myapp://test\""]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check URI format matches registered scheme"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sample-repository","__idx":26},"children":["Sample Repository"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete, production-ready implementation:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"},"children":["https://github.com/treasure-data/engage-push-notification-sample/tree/main/android"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The repository includes:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Full source code with inline documentation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Gradle configuration with Treasure Data SDK integration"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["AndroidManifest.xml setup"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Testing instructions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Security best practices"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Example configuration files"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"implementation-guide","__idx":27},"children":["Implementation Guide"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This section provides detailed instructions for building and testing the sample application."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"project-structure","__idx":28},"children":["Project Structure"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The sample repository follows this directory structure:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"android/\n├── app/\n│   ├── src/main/\n│   │   ├── java/com/treasuredata/pushsample/\n│   │   │   ├── MainActivity.kt              # Deep link and notification handling\n│   │   │   ├── MyApplication.kt             # App initialization & TD SDK setup\n│   │   │   ├── CategoryActivity.kt          # Category view example\n│   │   │   ├── ProductDetailActivity.kt     # Product detail example\n│   │   │   ├── fcm/\n│   │   │   │   ├── MyFirebaseMessagingService.kt  # FCM message receiver\n│   │   │   │   ├── PushEventReceiver.kt     # Notification action handler\n│   │   │   │   ├── PushAction.kt            # Action constants\n│   │   │   │   └── FcmTokenService.kt       # Token management\n│   │   │   └── utils/                       # Utility classes\n│   │   ├── res/\n│   │   │   ├── layout/\n│   │   │   ├── drawable/\n│   │   │   └── values/\n│   │   └── AndroidManifest.xml\n│   ├── build.gradle.kts\n│   └── google-services.json.example         # Firebase config template\n├── gradle/\n├── build.gradle.kts\n├── local.properties.example                 # TD configuration template\n└── settings.gradle.kts\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"build-and-run-instructions","__idx":29},"children":["Build and Run Instructions"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"prerequisites","__idx":30},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Android Studio Hedgehog (2023.1.1) or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["JDK 17 or later"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Android SDK 26 (Android 8.0) or later"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"setup-steps","__idx":31},"children":["Setup Steps"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Clone the repository:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"git clone https://github.com/treasure-data/engage-push-notification-sample.git\ncd engage-push-notification-sample/android\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":2},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open project in Android Studio:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Open Android Studio and select \"Open an Existing Project\"\n# Navigate to the android/ directory\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":3},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure Firebase:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Download ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-services.json"]}," from your Firebase project"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy it to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app/google-services.json"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Update ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["applicationId"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app/build.gradle.kts"]}," to match your Firebase app"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure Treasure Data:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties.example"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Edit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," with your Treasure Data configuration:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"properties","header":{"controls":{"copy":{}}},"source":"TD_WRITE_KEY=your_write_api_key_here\nTD_DATABASE=mobile\nTD_TABLE=push_events\nTD_ENDPOINT=https://in.treasuredata.com\n","lang":"properties"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important:"]}," Do not commit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," to version control"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sync Gradle:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click \"Sync Now\" when prompted"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Or File > Sync Project with Gradle Files"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Build and run:"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Via Gradle command line\n./gradlew assembleDebug\n\n# Or use Android Studio Run button (Shift+F10)\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"testing-workflow","__idx":32},"children":["Testing Workflow"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"prerequisites-1","__idx":33},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before testing, ensure you have:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Firebase project with Android app registered"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-services.json"]}," downloaded and placed in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app/"]}," directory"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Treasure Data database and table created"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Write-only API key obtained"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Android emulator or physical device with Google Play Services"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"test-on-emulator","__idx":34},"children":["Test on Emulator"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create/start Android emulator:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# List available emulators\nemulator -list-avds\n\n# Start emulator\nemulator -avd Pixel_5_API_34\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":2},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Install and run app:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"./gradlew installDebug\nadb shell am start -n com.treasuredata.pushsample/.MainActivity\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":3},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Monitor logs for FCM token:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb logcat | grep -E \"FCM token|FCMService\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Expected output:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"I/FcmTokenService: FCM token: [your-device-token]\nI/FcmTokenService: Registering FCM token: [token]\n"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":4},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send test notification from Firebase Console:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open Firebase Console > Cloud Messaging"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click \"Send your first message\""]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter title: \"Test Notification\""]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter body: \"This is a test\""]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click \"Send test message\""]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Paste your FCM token"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click \"Test\""]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Verify notification appears in system tray"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tap notification and verify:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["App opens (if closed)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}," event is tracked"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Deep link navigates correctly (if configured)"]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"test-on-physical-device","__idx":35},"children":["Test on Physical Device"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enable Developer Options:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Settings > About phone > Tap \"Build number\" 7 times"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enable USB Debugging:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Settings > System > Developer options > USB debugging"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Connect device via USB and install:"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Verify device is connected\nadb devices\n\n# Install app\n./gradlew installDebug\n\n# Launch app\nadb shell am start -n com.treasuredata.pushsample/.MainActivity\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":4},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Follow steps 3-6 from emulator testing above"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"test-notification-actions","__idx":36},"children":["Test Notification Actions"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create test payload with actions in Firebase Console:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Add custom data fields:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["campaign_id"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["test_campaign_001"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message_id"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["msg_001"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["myapp://product/12345"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://example.com/promo"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send notification and test:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tap notification body → Verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}," event"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tap web link → Verify Chrome Custom Tab opens"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tap deep link → Verify app navigation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Dismiss notification → Verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]}," event"]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"verify-event-tracking-1","__idx":37},"children":["Verify Event Tracking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Query Treasure Data to confirm events are being logged:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT\n  time,\n  type,\n  campaign_id,\n  platform,\n  user_id,\n  value\nFROM mobile.push_events\nWHERE platform = 'android'\n  AND time > td_time_add(now(), '-1h', 'JST')\nORDER BY time DESC\nLIMIT 20\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Expected event sequence:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}," - When app launches"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivery"]}," - When notification is received"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}," - When user taps notification"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_open"]}," - When user taps web link"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink_open"]}," - When user taps deep link"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]}," - When user dismisses notification"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"test-deep-links","__idx":38},"children":["Test Deep Links"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Test deep link handling using ADB:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Test product deep link\nadb shell am start \\\n  -W -a android.intent.action.VIEW \\\n  -d \"myapp://product/12345\" \\\n  com.treasuredata.pushsample\n\n# Test category deep link\nadb shell am start \\\n  -W -a android.intent.action.VIEW \\\n  -d \"myapp://category/electronics\" \\\n  com.treasuredata.pushsample\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Verify app opens and navigates to correct screen."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"implementation-checklist","__idx":39},"children":["Implementation Checklist"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this checklist when implementing push notifications in your own app:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-1-project-setup","__idx":40},"children":["Phase 1: Project Setup"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create Android project with minimum SDK 26 (Android 8.0)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add Firebase dependencies in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["build.gradle.kts"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add WorkManager, OkHttp, Chrome Custom Tabs dependencies"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Download and add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-services.json"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["app/"]}," directory"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Apply ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["com.google.gms.google-services"]}," plugin"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add required permissions in AndroidManifest.xml"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-2-manifest-configuration","__idx":41},"children":["Phase 2: Manifest Configuration"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Declare ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["INTERNET"]}," permission"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Declare ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST_NOTIFICATIONS"]}," permission (Android 13+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Register ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyFirebaseMessagingService"]}," in manifest"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Register ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PushEventReceiver"]}," broadcast receiver"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add intent filter for deep links in MainActivity"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Configure notification channels (Android 8+)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-3-core-components","__idx":42},"children":["Phase 3: Core Components"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyApplication"]}," class for app initialization"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Initialize Firebase in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCreate"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Initialize Treasure Data SDK with endpoint, database, and API key"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Configure TD SDK auto-tracking features (optional)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Implement ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyFirebaseMessagingService"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Implement ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onMessageReceived"]}," to handle FCM messages"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Implement ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onNewToken"]}," to handle token refresh"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FcmTokenService"]}," for token management"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-4-notification-display","__idx":43},"children":["Phase 4: Notification Display"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create notification channel with importance level"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Build notification with title, body, icon"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add PendingIntent for notification tap"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add PendingIntent for notification dismiss"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Download and attach images (if ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image_url"]}," present)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add action buttons for links (if configured)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Show notification with NotificationManager"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-5-event-tracking","__idx":44},"children":["Phase 5: Event Tracking"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivery"]}," event in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onMessageReceived"]}," using TD SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["open"]}," event when notification is tapped using TD SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dismiss"]}," event when notification is dismissed using TD SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["link_open"]}," event for web link taps using TD SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deeplink_open"]}," event for app link taps using TD SDK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Track ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_register"]}," event on app launch and token refresh using TD SDK"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-6-user-interaction-handling","__idx":45},"children":["Phase 6: User Interaction Handling"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PushEventReceiver"]}," to handle broadcast intents"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Handle ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUSH_OPEN"]}," action in receiver"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Handle ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUSH_DISMISS"]}," action in receiver"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Handle ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUSH_ACTION_LINK"]}," action in receiver"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Handle ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUSH_ACTION_DEEPLINK"]}," action in receiver"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Open Chrome Custom Tab for web links"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Parse and navigate deep links in MainActivity"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-7-configuration-and-security","__idx":46},"children":["Phase 7: Configuration and Security"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Create ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," with TD configuration"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".gitignore"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["google-services.json"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".gitignore"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Configure BuildConfig fields from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Implement error handling for TD SDK operations"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Add ProGuard rules for Treasure Data SDK if using R8/ProGuard"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"phase-8-testing","__idx":47},"children":["Phase 8: Testing"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Request ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST_NOTIFICATIONS"]}," permission at runtime (Android 13+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test notification delivery on emulator"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test notification delivery on physical device"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test notification images"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test notification action buttons"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test deep link navigation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test web link opening with Chrome Custom Tabs"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Verify events appear in Treasure Data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test background notification handling"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"input","attributes":{"checked":false,"type":"checkbox","readOnly":true},"children":[]}," Test foreground notification handling"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"build-troubleshooting","__idx":48},"children":["Build Troubleshooting"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"google-servicesjson-is-missing-error","__idx":49},"children":["\"google-services.json is missing\" Error"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Ensure file is in correct location\nls app/google-services.json\n\n# Sync Gradle files\n./gradlew --refresh-dependencies\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"manifest-merger-failed-error","__idx":50},"children":["\"Manifest merger failed\" Error"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check for duplicate permissions or activities in AndroidManifest.xml"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify all library versions are compatible"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./gradlew clean"]}," and rebuild"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"treasure-data-sdk-not-uploading-events","__idx":51},"children":["Treasure Data SDK Not Uploading Events"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Check SDK initialization logs\nadb logcat | grep TreasureData\n\n# Enable debug logging in MyApplication.kt:\nTreasureData.enableLogging()\n\n# Verify BuildConfig values are set correctly\n# Check build/generated/source/buildConfig/debug/.../BuildConfig.java\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"notifications-not-appearing","__idx":52},"children":["Notifications Not Appearing"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify Google Play Services is installed on device/emulator"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check notification permission is granted (Android 13+)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify notification channel is created with correct importance"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check logcat for FCM errors: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb logcat | grep FCM"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"events-not-uploading-to-treasure-data","__idx":53},"children":["Events Not Uploading to Treasure Data"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TD_WRITE_KEY"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["local.properties"]}," is correct"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check network connectivity"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TD_ENDPOINT"]}," matches your region"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check Treasure Data SDK logs: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb logcat | grep TreasureData"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Verify SDK is initialized correctly in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MyApplication.onCreate()"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Try calling ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TreasureData.sharedInstance().uploadEvents()"]}," manually to force upload"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"deep-links-not-working-1","__idx":54},"children":["Deep Links Not Working"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Verify intent filter is registered\nadb shell dumpsys package com.treasuredata.pushsample | grep -A 5 \"scheme\"\n\n# Test deep link manually\nadb shell am start -W -a android.intent.action.VIEW -d \"myapp://test\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"gradle-commands-reference","__idx":55},"children":["Gradle Commands Reference"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Clean build\n./gradlew clean\n\n# Build debug APK\n./gradlew assembleDebug\n\n# Build release APK (requires signing config)\n./gradlew assembleRelease\n\n# Install on connected device\n./gradlew installDebug\n\n# Run unit tests\n./gradlew testDebugUnitTest\n\n# Run instrumented tests\n./gradlew connectedDebugAndroidTest\n\n# Check for dependency updates\n./gradlew dependencyUpdates\n\n# Lint check\n./gradlew lintDebug\n\n# Generate dependency tree\n./gradlew app:dependencies\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":56},"children":["Next Steps"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Clone the sample repository"]}," and review the implementation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configure Firebase"]}," following the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/mobile-push-setup"},"children":["Mobile Push Setup"]}," guide"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Implement the components"]}," in your Android app"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Test notification delivery"]}," and event tracking"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Review event data"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/push-events-table"},"children":["Push Events Table"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create your first campaign"]}," in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push"},"children":["Engage Studio"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-documentation","__idx":57},"children":["Related Documentation"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/mobile-push-setup"},"children":["Mobile Push Setup"]}," - Firebase and Treasure Data configuration"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/developer-guide-ios"},"children":["iOS Developer Guide"]}," - iOS implementation guide"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push/push-events-table"},"children":["Push Events Table"]}," - Event schema and analytics queries"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/marketing-cloud/engage-studio/channels/mobile-push"},"children":["Campaign Creation"]}," - Create Mobile Push campaigns"]}]}]},"headings":[{"value":"Android Developer Guide","id":"android-developer-guide","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Requirements","id":"requirements","depth":2},{"value":"Architecture Overview","id":"architecture-overview","depth":2},{"value":"Implementation Components","id":"implementation-components","depth":2},{"value":"1. Application Class","id":"1-application-class","depth":3},{"value":"2. Firebase Messaging Service","id":"2-firebase-messaging-service","depth":3},{"value":"3. Push Event Receiver","id":"3-push-event-receiver","depth":3},{"value":"4. FCM Token Service","id":"4-fcm-token-service","depth":3},{"value":"5. MainActivity Integration","id":"5-mainactivity-integration","depth":3},{"value":"Data Payload Schema","id":"data-payload-schema","depth":2},{"value":"Event Tracking","id":"event-tracking","depth":2},{"value":"Configuration Requirements","id":"configuration-requirements","depth":2},{"value":"AndroidManifest.xml","id":"androidmanifestxml","depth":3},{"value":"build.gradle.kts","id":"buildgradlekts","depth":3},{"value":"local.properties","id":"localproperties","depth":3},{"value":"Notification Permissions","id":"notification-permissions","depth":3},{"value":"User ID Association","id":"user-id-association","depth":2},{"value":"Testing","id":"testing","depth":2},{"value":"Test Notification Delivery","id":"test-notification-delivery","depth":3},{"value":"Verify Event Tracking","id":"verify-event-tracking","depth":3},{"value":"Security Best Practices","id":"security-best-practices","depth":2},{"value":"Troubleshooting","id":"troubleshooting","depth":2},{"value":"Notifications Not Received","id":"notifications-not-received","depth":3},{"value":"Events Not Appearing in Treasure Data","id":"events-not-appearing-in-treasure-data","depth":3},{"value":"Deep Links Not Working","id":"deep-links-not-working","depth":3},{"value":"Sample Repository","id":"sample-repository","depth":2},{"value":"Implementation Guide","id":"implementation-guide","depth":2},{"value":"Project Structure","id":"project-structure","depth":3},{"value":"Build and Run Instructions","id":"build-and-run-instructions","depth":3},{"value":"Prerequisites","id":"prerequisites","depth":4},{"value":"Setup Steps","id":"setup-steps","depth":4},{"value":"Testing Workflow","id":"testing-workflow","depth":3},{"value":"Prerequisites","id":"prerequisites-1","depth":4},{"value":"Test on Emulator","id":"test-on-emulator","depth":4},{"value":"Test on Physical Device","id":"test-on-physical-device","depth":4},{"value":"Test Notification Actions","id":"test-notification-actions","depth":4},{"value":"Verify Event Tracking","id":"verify-event-tracking-1","depth":4},{"value":"Test Deep Links","id":"test-deep-links","depth":4},{"value":"Implementation Checklist","id":"implementation-checklist","depth":3},{"value":"Phase 1: Project Setup","id":"phase-1-project-setup","depth":4},{"value":"Phase 2: Manifest Configuration","id":"phase-2-manifest-configuration","depth":4},{"value":"Phase 3: Core Components","id":"phase-3-core-components","depth":4},{"value":"Phase 4: Notification Display","id":"phase-4-notification-display","depth":4},{"value":"Phase 5: Event Tracking","id":"phase-5-event-tracking","depth":4},{"value":"Phase 6: User Interaction Handling","id":"phase-6-user-interaction-handling","depth":4},{"value":"Phase 7: Configuration and Security","id":"phase-7-configuration-and-security","depth":4},{"value":"Phase 8: Testing","id":"phase-8-testing","depth":4},{"value":"Build Troubleshooting","id":"build-troubleshooting","depth":3},{"value":"\"google-services.json is missing\" Error","id":"google-servicesjson-is-missing-error","depth":4},{"value":"\"Manifest merger failed\" Error","id":"manifest-merger-failed-error","depth":4},{"value":"Treasure Data SDK Not Uploading Events","id":"treasure-data-sdk-not-uploading-events","depth":4},{"value":"Notifications Not Appearing","id":"notifications-not-appearing","depth":4},{"value":"Events Not Uploading to Treasure Data","id":"events-not-uploading-to-treasure-data","depth":4},{"value":"Deep Links Not Working","id":"deep-links-not-working-1","depth":4},{"value":"Gradle Commands Reference","id":"gradle-commands-reference","depth":3},{"value":"Next Steps","id":"next-steps","depth":2},{"value":"Related Documentation","id":"related-documentation","depth":2}],"frontmatter":{"seo":{"title":"Android Developer Guide"}},"lastModified":"2026-01-09T01:43:16.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/marketing-cloud/engage-studio/channels/mobile-push/developer-guide-android","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}