-
Notifications
You must be signed in to change notification settings - Fork 70
feat: Add AppsFlyer SDK 7 kit (appsflyer-7) #748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jamesnrokt
wants to merge
1
commit into
main
Choose a base branch
from
feat/appsflyer-7-kit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). | ||||||
|
|
||||||
| 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+' | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| 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) | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
40
kits/appsflyer/appsflyer-7/example/example-kotlin/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | ||
| } |
22 changes: 22 additions & 0 deletions
22
kits/appsflyer/appsflyer-7/example/example-kotlin/src/main/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
24 changes: 24 additions & 0 deletions
24
.../main/kotlin/com/mparticle/kits/appsflyer/appsflyer7/example/kotlin/ExampleApplication.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(), | ||
| ) | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...in/src/main/kotlin/com/mparticle/kits/appsflyer/appsflyer7/example/kotlin/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...flyer/appsflyer-7/example/example-kotlin/src/main/res/drawable/ic_launcher_foreground.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
14 changes: 14 additions & 0 deletions
14
kits/appsflyer/appsflyer-7/example/example-kotlin/src/main/res/layout/activity_main.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
5 changes: 5 additions & 0 deletions
5
...psflyer/appsflyer-7/example/example-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
5 changes: 5 additions & 0 deletions
5
...r/appsflyer-7/example/example-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
4 changes: 4 additions & 0 deletions
4
kits/appsflyer/appsflyer-7/example/example-kotlin/src/main/res/values/colors.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
4 changes: 4 additions & 0 deletions
4
kits/appsflyer/appsflyer-7/example/example-kotlin/src/main/res/values/strings.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
5 changes: 5 additions & 0 deletions
5
kits/appsflyer/appsflyer-7/gradle/wrapper/gradle-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.