How adjust/android_sdk works
Project Type and Purpose
• This is an Android SDK library that offers core functionality (in the sdk-core directory) and extended features through a number of plugins (found in the plugins directory). These plugins (such as those for Huawei, Xiaomi, Samsung, and others) are meant to provide integrations with various device-specific or third-party services.
• Alongside these, there are multiple examples organized by language (Java, Kotlin) and use-cases (e.g., keyboard integration, webbridge) that demonstrate how to integrate and use the Adjust SDK in different Android applications. There are also tests that help ensure reliability and correct behavior.
Key Components (from File Structure)
• Adjust/sdk-core: This is the heart of the system that contains the core classes and functionalities (e.g., Adjust.java, ActivityHandler.java, network modules, schedulers, etc.). It provides the main interfaces and handles operations like event tracking, session management, and attribution.
• Adjust/plugins: Each subfolder here represents a plugin module that extends the SDK’s functionality. They add support for various device-specific or data-gathering features (e.g., imei, meta-referrer, oaid, and integrations with Samsung, Huawei, Vivo, and Xiaomi). These plugins usually have their own implementation modules and resources.
• Examples: There are multiple sample projects (e.g., example-app-java, example-app-kotlin, example-app-fbpixel, etc.) that show how to use the SDK in different configurations and application scenarios. They include standard Android project structures with manifests, activities, resources, and sometimes, assets.
• Tests: The tests directory contains test applications and test libraries that ensure the core and plugin functionalities work as expected.
Relationships, Interactions, and Architectural Patterns
• The core SDK acts as the foundation and provides a set of public APIs (via Adjust.java and supporting classes) that get called from within an Android application. It manages the overall flow including activity monitoring, network communication (packaged inside the network and scheduler submodules), and persistence (via shared preferences and internal state management).
• The plugins build upon the core SDK and add vendor-specific integrations. They are designed in a modular way so that they can be integrated or omitted depending on the application’s requirements.
• The sample projects depend on the core SDK (and any required plugins) to illustrate integration. They typically initialize the SDK (through configuration classes such as AdjustConfig) in their Application classes or activities.
• The system is largely event-driven. Android lifecycle callbacks and asynchronous networking/scheduling (in components such as ThreadScheduler or SingleThreadFutureScheduler) drive the interactions between the app, core SDK, and plugins.
• The SDK is architected to interact with the Android framework in typical ways (e.g., via content providers, broadcast receivers for referrer events, etc.), and provides multiple listener interfaces for callbacks (e.g., OnAttributionChangedListener, OnDeeplinkResolvedListener) that allow the app to respond to events.