mParticle Android
This documentation explains how to send mParticle events to your Branch dashboard. If you'd like to send Branch installs to your mParticle dashboard, please review the Branch/mParticle Data Integration.
这些说明适用于 mParticle SDK 版本 5+ 集成
mParticle introduced a new attribution & deep linking API in v5 of their SDK (http://docs.mparticle.com/developers/sdk/android/getting-started/#upgrade-to-version-5-of-the-sdk), so please contact your Branch or mParticle Account Managers for more details, if you have mParticle SDK <v5 installed in your app.
Google Play Services 17+版本
2019年6月 Google Play Services 进行的一次重大更新导致 Branch 的 Android SDK(以及其他各种跨平台 SDK,例如 Unity)停止收集 Android AID。
To ensure Branch deep linking and attribution continue to work, you must follow Google's update instructions here.
如果您运行的 Google Play Services 版本低于17,则无需更新。
技术要求
Branch 设置
配置 Branch 并启用 App Links
- Retrieve your app's fingerprint to enable App Links in Branch
- Decide on a URI scheme to use, and configure your Branch Dashboard


- Add the following intent filter for the Branch URI scheme to the
LauncherActivity
in your Android Manifest
<!-- Branch URI Scheme -->
<intent-filter>
<data android:scheme="androidexample" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
- Add the following intent filter for the Branch
app.link
domains to theLauncherActivity
in your Android manifest
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="example.app.link" />
<data android:scheme="https" android:host="example-alternate.app.link" />
</intent-filter>
- 添加
android:launchMode="singleTask"
to theLauncherActivity
<!-- Launcher Activity to handle incoming Branch intents -->
<activity
android:name=".LauncherActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- Make sure onNewIntent is setting a new intent every time your
LauncherActivity.java
打开
public class LauncherActivity extends AppCompatActivity {
@Override
public void onNewIntent(Intent intent) {
this.setIntent(intent);
}
}
class LauncherActivity : AppCompatActivity() {
public override fun onNewIntent(intent: Intent) {
this.intent = intent
}
}
mParticle 设置
在 mParticle 上启用 Branch
- Before you can enable Branch in your mParticle dashboard, you must retrieve your Branch Key on the Link Settings page of your Branch dashboard.
- Please follow mParticle's documentation on how to Connect an Event Output; i.e. enable the Branch integration.
在 mParticle 操作后台 (Dashboard)中添加了工具包并配置了 Branch API Key 之后,mParticle SDK 将负责初始化 Branch SDK 并转发适当的应用 Lifecycle Event 以处理深度链接。
安装 mParticle Branch 工具包
导入 Android Support Libraries
'com.android.support:customtabs:23.3.0'
'com.google.android.gms:play-services-ads:9+'
'com.google.android.gms:play-services-appindexing:9.+'
在 mParticle 工具包中初始化 Branch
As with any kit, mParticle will automatically handle initializing Branch sessions. Please ensure mParticle.start()
is called in your Android Application class (this should already be accounted for in your base mParticle integration).
此时,您应该开始在 Branch 操作后台 (Dashboard)中看到 Branch 会话数据(包括安装,重新打开和所有自定义事件)。
要求
[x] As with any attribution-related integration, be sure that you have added the mParticle
ReferrerReceiver
to your app’sAndroidManifest.xml
通过 mParticle 获得深度链接数据
我们与 mParticle 的集成支持创建和归属用于安装和打开应用的深度链接。深度链接通常将包含一些其他信息,这些信息将在用户最终打开您的应用时使用,以便您可以将用户正确地导到适当的内容,或者以其他方式自定义他们的体验。
Please ensure you've followed mParticle's documentation to ensure your deep link data is being retrieved.
React Native 中的 mParticle
If you integrate mParticle in React Native, you will still integrate the Branch kit as a Native module and follow the setup steps above. However, instead of retrieving deep link data in the the native layer, you'll retrieve deep link data via mParticle's React Native function found here.
测试深度链接
- Create a deep link from the Branch Dashboard
- 从设备中删除您的应用
- 将您的应用编译到设备上
- Paste deep link in Google Hangouts
- 点击深度链接打开您的应用
实现功能
- Please refer to mParticle's making direct calls to kits documentation for how to access the Branch kit via the mParticle SDK.
- Direct calls to the Branch SDK will also require using
.getAutoInstance()
, rather than.getInstance()
。 - Once you have a reference to the Branch kit, refer to Branch's native Android SDK documentation for how to implement secondary functionality.
示例测试应用
问题排查
Please refer to the Branch Android SDK troubleshooting section.
Updated 4 months ago