-
Notifications
You must be signed in to change notification settings - Fork 214
Packaged Integrations
We're in the process of decoupling integrations from our main library. This lets partners host integrations themselves and eliminates the barrier of releasing independent updates to those integrations.
This update is an API compatible release, and the process for using our library hasn't changed significantly. The only change is how bundled integrations are picked up our library. Bundling an integration is a 2 step process:
-
Add the integration dependency.
-
Register it in your builder.
First, you need to install our SDK. Use the snapshot releases for now.
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
compile 'com.segment.analytics.android:analytics-core:4.0.0-SNAPSHOT'
}
This will install only the Segment integration. If you need to add more integrations, add them as a dependency manually.
compile('com.segment.analytics.android.integrations:google-analytics:1.0.0-SNAPSHOT') {
transitive = true
}
compile('io.branch.segment.analytics.android.integrations:library:1.0.0-RELEASE') {
transitive = true
}
...
Once you've setup your dependencies, you need to initialize our SDK with your bundled integrations.
Analytics analytics = new Analytics.Builder(context, writeKey)
.use(GoogleAnalyticsIntegration.FACTORY)
.use(BranchIntegration.FACTORY)
...
.build();
<!-- Required for internet. -->
<uses-permission android:name="android.permission.INTERNET"/>
You might need to add more permissions required by bundled integrations. Refer to their documentation for more details.
The rest of the steps are the same as before.
v4 is an API compatible release, but there are a few additional steps to bundle integrations.
- Add the integration dependencies.
compile('com.segment.analytics.android.integrations:google-analytics:1.0.0-SNAPSHOT') {
transitive = true
}
compile('io.branch.segment.analytics.android.integrations:library:1.0.0-RELEASE') {
transitive = true
}
...
- Register them in your builder when you initialize the SDK.
Analytics analytics = new Analytics.Builder(context, writeKey)
.use(GoogleAnalyticsIntegration.FACTORY)
.use(BranchIntegration.FACTORY)
...
.build();