# appsflyersdk/appsflyer-onelink-android-sample-apps architecture

> Architecture diagram of the GitHub repository appsflyersdk/appsflyer-onelink-android-sample-apps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/appsflyersdk/appsflyer-onelink-android-sample-apps
- Repository: https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps

## Overview

##### Project Type and Purpose
- This is an Android sample application designed to demonstrate the usage of Appsflyer Onelink—a unified deep linking solution. The project clearly supports deep linking (both direct and deferred) and is intended to serve as a guide for integrating personalized deep linking in mobile apps.
- Two implementations are available, one written in Java and one in Kotlin. This indicates that the sample is meant to be language agnostic and show best practices in both popular Android development languages.

##### Main Components and Their Roles
- Mobile Application Layer: The app itself is the core, containing the Android-specific components.
- Activities: Multiple activities (e.g., MainActivity, ApplesActivity, BananasActivity, ConversionDataActivity, FruitActivity, PeachesActivity) represent different screens or entry points showing deep link behaviors.
- UI Resources: XML layout files under “res/layout” and UI themes/styles under “res/values” and “res/xml” represent the visual aspect.
- Deep Linking Component: This is the integration point with Appsflyer OneLink. The code (notably in constants and initialization classes like AppsflyerBasicApp) indicates configuration and handling of deep linking data for personalization.
- Build and Configuration Components: Gradle build files (build.gradle, settings.gradle, and their Kotlin script counterparts) are responsible for dependency management and are fundamental to project orchestration.
- Language Variants: The two parallel structures under “java/basic_app” and “kotlin/basic_app” emphasize the usage of Android’s architecture but implemented in different languages. They share a similar structure to demonstrate that the deep linking integration works uniformly.
- External Service: Although not explicitly depicted as a standalone module, the integration calls and configuration (typically found in the Appsflyer-specific classes and constants) interface with Appsflyer’s backend services.

##### Relationships and Interactions
- The Android application layer relies on Android’s framework to drive UI navigation. Each activity is a node that may be launched either via standard app flow (like the main activity) or through deep linking events.
- The deep linking component receives data payloads from the Appsflyer service. The app processes these inputs to render personalized content through designated activities.
- Dependencies flow from the application launch component (AppsflyerBasicApp) to the various activities, with configuration data passed via Intent extras. This is typically set up in the application initialization logic.
- Gradle build scripts and properties define and manage these dependencies, ensuring that the build system correctly pulls in Appsflyer libraries and any other external dependencies.

##### Architectural Patterns
- The project follows a standard Android architecture where Activities handle the UI and user interactions.
- There’s emphasis on modularity by separating UI resources, application logic, and deep linking configuration. Even though the project is a sample, it reflects good practices in organizing app components.
- The use of multiple language folders (Java and Kotlin) illustrates best practices in code separation for maintainability and readability.

- a. Main Components:
- Android App Base (presented as a container for the mobile application)
- UI Layer (Activities and layouts): Include MainActivity, ApplesActivity, BananasActivity, etc.
- Deep Linking Integration Module (containing classes like AppsflyerBasicApp and AppsFlyerConstants)
- Build & Configuration (represented by Gradle scripts and properties)
- External Appsflyer Service (one link backend integration)

- b. Relationships and Interactions:
- Inside the app container, connect the Application Initialization (AppsflyerBasicApp) to the different Activities to show navigation flows.
- Link Gradle/Build Configurations to the Android App to show dependency management and build flows.

- c. Highlight Architectural Patterns:
- Use a layered approach separating the UI layer (Activities, layouts) from the integration/configuration layer (Appsflyer initialization and constants).
- That the deep linking feature is integrated as a cross-cutting concern that affects the navigation and UI rendering of the user.

- d. Technologies/Frameworks:
- That the project utilizes Android SDK, Gradle (and Gradle Kotlin DSL for one variant), and Appsflyer SDK for OneLink.

## Diagram (Mermaid)

```mermaid
graph TD
    ext["Appsflyer OneLink Service"]:::cloud
    base["Android App Base"]:::android

    ext -->|"DeepLinkPayload"| base

    %% Java Implementation
    subgraph "Java Implementation"
        JavaBase["Android App Base (Java)"]:::androidBase

        subgraph "Deep Linking Integration Module (Java)"
            JavaInit["AppsflyerBasicApp (Java)"]:::config
            JavaConfig["AppsFlyerConstants (Java)"]:::config
        end

        subgraph "UI Resources (Java)"
            JavaLayouts["Layouts (Java)"]:::resource
            JavaValues["Values&Themes (Java)"]:::resource
        end

        subgraph "Build & Config (Java)"
            JavaBuild["Build&Config (Java)"]:::build
        end

        subgraph "Activities (Java)"
            A_Main["MainActivity (Java)"]:::activity
            A_Apples["ApplesActivity (Java)"]:::activity
            A_Bananas["BananasActivity (Java)"]:::activity
            A_Conversion["ConversionDataActivity (Java)"]:::activity
            A_Fruit["FruitActivity (Java)"]:::activity
            A_Peaches["PeachesActivity (Java)"]:::activity
        end

        JavaBase --> JavaInit
        JavaBase --> JavaConfig

        JavaLayouts --> A_Main
        JavaLayouts --> A_Apples
        JavaLayouts --> A_Bananas
        JavaLayouts --> A_Conversion
        JavaLayouts --> A_Fruit
        JavaLayouts --> A_Peaches

        JavaValues --> A_Main
        JavaValues --> A_Apples
        JavaValues --> A_Bananas
        JavaValues --> A_Conversion
        JavaValues --> A_Fruit
        JavaValues --> A_Peaches

        JavaInit --> A_Main
        JavaInit --> A_Apples
        JavaInit --> A_Bananas
        JavaInit --> A_Conversion
        JavaInit --> A_Fruit
        JavaInit --> A_Peaches

        JavaBuild --> JavaBase

        %% External service connects to deep linking integration
        ext -->|"DeepLinkPayload"| JavaInit
        ext -->|"DeepLinkPayload"| JavaConfig
    end

    %% Kotlin Implementation
    subgraph "Kotlin Implementation"
        KotlinBase["Android App Base (Kotlin)"]:::androidBase

        subgraph "Deep Linking Integration Module (Kotlin)"
            KotlinInit["AppsflyerBasicApp (Kotlin)"]:::config
            KotlinConfig["AppsFlyerConstants (Kotlin)"]:::config
        end

        subgraph "UI Resources (Kotlin)"
            KotlinLayouts["Layouts (Kotlin)"]:::resource
            KotlinValues["Values&Themes (Kotlin)"]:::resource
        end

        subgraph "Build & Config (Kotlin)"
            KotlinBuild["Build&Config (Kotlin)"]:::build
        end

        subgraph "Activities (Kotlin)"
            K_Main["MainActivity (Kotlin)"]:::activity
            K_Apples["ApplesActivity (Kotlin)"]:::activity
            K_Bananas["BananasActivity (Kotlin)"]:::activity
            K_Conversion["ConversionDataActivity (Kotlin)"]:::activity
            K_Fruit["FruitActivity (Kotlin)"]:::activity
            K_Peaches["PeachesActivity (Kotlin)"]:::activity
        end

        KotlinBase --> KotlinInit
        KotlinBase --> KotlinConfig

        KotlinLayouts --> K_Main
        KotlinLayouts --> K_Apples
        KotlinLayouts --> K_Bananas
        KotlinLayouts --> K_Conversion
        KotlinLayouts --> K_Fruit
        KotlinLayouts --> K_Peaches

        KotlinValues --> K_Main
        KotlinValues --> K_Apples
        KotlinValues --> K_Bananas
        KotlinValues --> K_Conversion
        KotlinValues --> K_Fruit
        KotlinValues --> K_Peaches

        KotlinInit --> K_Main
        KotlinInit --> K_Apples
        KotlinInit --> K_Bananas
        KotlinInit --> K_Conversion
        KotlinInit --> K_Fruit
        KotlinInit --> K_Peaches

        KotlinBuild --> KotlinBase

        %% External service connects to deep linking integration
        ext -->|"DeepLinkPayload"| KotlinInit
        ext -->|"DeepLinkPayload"| KotlinConfig
    end

    base -->|"Java Implementation"| JavaBase
    base -->|"Kotlin Implementation"| KotlinBase

    %% Styles
    classDef cloud fill:#ccf,stroke:#333,stroke-width:2px;
    classDef android fill:#cfc,stroke:#333,stroke-width:2px;
    classDef androidBase fill:#afa,stroke:#333,stroke-width:2px;
    classDef config fill:#fdd,stroke:#333,stroke-width:2px;
    classDef resource fill:#ffd,stroke:#333,stroke-width:2px;
    classDef build fill:#dfd,stroke:#333,stroke-width:2px;
    classDef activity fill:#ddf,stroke:#333,stroke-width:2px;

click JavaBase "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/java/basic_app/app"
click KotlinBase "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/kotlin/basic_app/app"

click A_Main "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/MainActivity.java"
click A_Apples "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/ApplesActivity.java"
click A_Bananas "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/BananasActivity.java"
click A_Conversion "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/ConversionDataActivity.java"
click A_Fruit "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/FruitActivity.java"
click A_Peaches "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/PeachesActivity.java"

click K_Main "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/MainActivity.kt"
click K_Apples "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/ApplesActivity.kt"
click K_Bananas "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/BananasActivity.kt"
click K_Conversion "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/ConversionDataActivity.kt"
click K_Fruit "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/FruitActivity.kt"
click K_Peaches "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/PeachesActivity.kt"

click JavaInit "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/AppsflyerBasicApp.java"
click JavaConfig "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/AppsFlyerConstants.java"
click KotlinInit "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/AppsflyerBasicApp.kt"
click KotlinConfig "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/src/main/kotlin/com/appsflyer/onelink/appsflyeronelinkbasicapp/AppsFlyerConstants.kt"

click JavaLayouts "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/java/basic_app/app/src/main/res/layout"
click JavaValues "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/java/basic_app/app/src/main/res/values"
click KotlinLayouts "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/kotlin/basic_app/app/src/main/res/layout"
click KotlinValues "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/tree/master/kotlin/basic_app/app/src/main/res/values"

click JavaBuild "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/java/basic_app/app/build.gradle"
click KotlinBuild "https://github.com/appsflyersdk/appsflyer-onelink-android-sample-apps/blob/master/kotlin/basic_app/app/build.gradle.kts"
```
