Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions kits/appsflyer/appsflyer-7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# AppsFlyer Kit Integration

This repository contains the [AppsFlyer](https://www.appsflyer.com/) integration for the [mParticle Android SDK](https://github.com/mParticle/mparticle-android-sdk).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This repository contains the [AppsFlyer](https://www.appsflyer.com/) integration for the [mParticle Android SDK](https://github.com/mParticle/mparticle-android-sdk).
This directory contains the [AppsFlyer](https://www.appsflyer.com/) integration for the [mParticle Android SDK](https://github.com/mParticle/mparticle-android-sdk).


This kit targets **AppsFlyer Android SDK 7.x**. For AppsFlyer 6.x, use the `appsflyer-6` kit instead.
AppsFlyer 7.x requires `minSdk 21`.

## Adding the integration

1. Add the kit dependency to your app's build.gradle:

```groovy
dependencies {
implementation 'com.mparticle:appsflyer-7:5+'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
implementation 'com.mparticle:appsflyer-7:5+'
implementation 'com.mparticle:appsflyer-7:6+'

}
```

2. Follow the mParticle Android SDK [quick-start](https://github.com/mParticle/mparticle-android-sdk), then rebuild and launch your app, and verify that you see `"AppsFlyer detected"` in the output of `adb logcat`.
3. Reference mParticle's integration docs below to enable the integration.
4. If you wish to utilize Appsflyers InstallReferrer capabilities, add a dependency for Play Install Referrer library in you app's build.gradle. For more information visit the [Appsflyer SDK's documentation page](https://support.appsflyer.com/hc/en-us/articles/207032066#attribution) on the subject:

```groovy
dependencies {
implementation "com.android.installreferrer:installreferrer:2.2"
}
```

## Migrating from the `appsflyer-6` kit

AppsFlyer 7.0 relocated much of its public API and removed several methods. The kit absorbs most of
this, but two changes are visible to integrating apps:

- **`minSdk` is now 21** (AppsFlyer 7.x raised its own minimum from 19).
- **Email identities are forwarded via AppsFlyer's `setUserEmail`.** AppsFlyer 7.0 removed
`setUserEmails(EmailsCryptType, ...)` along with the `EmailsCryptType` enum, so the kit can no
longer request SHA256 hashing on AppsFlyer's side. The kit previously passed
`EmailsCryptType.NONE` (plaintext), so the value actually forwarded is unchanged.

AppsFlyer 7.x also splits its implementation into a companion `com.appsflyer:af-android-sdk-base`
artifact, which resolves transitively.

If your app calls the AppsFlyer SDK directly in addition to using this kit, see AppsFlyer's own 7.0
migration notes — the `com.appsflyer.*` -> `com.appsflyer.share.*` package move affects your code too.

## Documentation

[AppsFlyer integration](http://docs.mparticle.com/integrations/appsflyer/event/)

## License

[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
69 changes: 69 additions & 0 deletions kits/appsflyer/appsflyer-7/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
buildscript {
ext.kotlin_version = '2.1.20'
if (!project.hasProperty('version') || project.version.equals('unspecified')) {
project.version = '+'
}

repositories {
google()
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'com.mparticle:android-kit-plugin:' + project.version
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id "org.sonarqube" version "3.5.0.2730"
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
}

sonarqube {
properties {
property "sonar.projectKey", "mparticle-android-integration-appsflyer-7"
property "sonar.organization", "mparticle"
property "sonar.host.url", "https://sonarcloud.io"
}
}

apply plugin: 'org.jlleitschuh.gradle.ktlint'
apply plugin: 'kotlin-android'
apply plugin: 'com.mparticle.kit'

android {
namespace 'com.mparticle.kits.appsflyer7'
buildFeatures {
buildConfig = true
}
defaultConfig {
minSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
testOptions {
unitTests.all {
jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
}
}
}

ktlint {
android.set(true)
}

dependencies {
api 'com.appsflyer:af-android-sdk:[7.0.0,8.0.0)'
testImplementation files('libs/java-json.jar')
testImplementation files('libs/testutils.aar')
}
repositories {
mavenCentral()
}
Empty file.
40 changes: 40 additions & 0 deletions kits/appsflyer/appsflyer-7/example/example-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.mparticle.kits.appsflyer.appsflyer7.example.kotlin'
compileSdk 35

defaultConfig {
applicationId 'com.mparticle.kits.appsflyer.appsflyer7.example.kotlin'
minSdk 21
targetSdk 35
versionCode 1
versionName '1.0'
multiDexEnabled true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
implementation project(':kits:appsflyer:appsflyer-7')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.multidex:multidex:2.0.1'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".ExampleApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.mparticle.kits.appsflyer.appsflyer7.example.kotlin

import androidx.multidex.MultiDexApplication
import com.mparticle.MPEvent
import com.mparticle.MParticle
import com.mparticle.MParticleOptions

class ExampleApplication : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
val options =
MParticleOptions
.builder(this)
.credentials(
"REPLACE WITH YOUR MPARTICLE API KEY",
"REPLACE WITH YOUR MPARTICLE API SECRET",
).logLevel(MParticle.LogLevel.VERBOSE)
.build()
MParticle.start(options)
MParticle.getInstance()?.logEvent(
MPEvent.Builder("foo", MParticle.EventType.Other).build(),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mparticle.kits.appsflyer.appsflyer7.example.kotlin

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AppsFlyer Kit Kotlin Example</string>
</resources>
4 changes: 4 additions & 0 deletions kits/appsflyer/appsflyer-7/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading