How appsflyersdk/appsflyer-onelink-android-sample-apps works
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.