Batch.com Android Segment SDK Integration

Batch.com's Segment SDK Integration main artifact

License

License

MIT
GroupId

GroupId

com.batch.android
ArtifactId

ArtifactId

sdk-segment-integration
Last Version

Last Version

2.0.2
Release Date

Release Date

Type

Type

aar
Description

Description

Batch.com Android Segment SDK Integration
Batch.com's Segment SDK Integration main artifact
Project URL

Project URL

https://batch.com
Source Code Management

Source Code Management

https://github.com/BatchLabs/android-segment-integration

Download sdk-segment-integration

How to add to project

<!-- https://jarcasting.com/artifacts/com.batch.android/sdk-segment-integration/ -->
<dependency>
    <groupId>com.batch.android</groupId>
    <artifactId>sdk-segment-integration</artifactId>
    <version>2.0.2</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.batch.android/sdk-segment-integration/
implementation 'com.batch.android:sdk-segment-integration:2.0.2'
// https://jarcasting.com/artifacts/com.batch.android/sdk-segment-integration/
implementation ("com.batch.android:sdk-segment-integration:2.0.2")
'com.batch.android:sdk-segment-integration:aar:2.0.2'
<dependency org="com.batch.android" name="sdk-segment-integration" rev="2.0.2">
  <artifact name="sdk-segment-integration" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.batch.android', module='sdk-segment-integration', version='2.0.2')
)
libraryDependencies += "com.batch.android" % "sdk-segment-integration" % "2.0.2"
[com.batch.android/sdk-segment-integration "2.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
com.batch.android : batch-sdk jar 1.13.0

Project Modules

There are no modules declared in this project.

analytics-android-integration-batch

Maven Central

Batch.com integration for analytics-android.

Usage

After adding the dependency, you must register the integration with our SDK. To do this, import the Batch integration:

import com.segment.analytics.android.integrations.batch.BatchIntegration;

And add the following line:

Analytics analytics = new Analytics.Builder(this, "write_key")
                .use(BatchIntegration.getFactory(this))
                .build();

Please also add the following to all of your activities:

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Batch.onNewIntent(intent);
}

Track an event :

Properties trackProperties = new Properties();
trackProperties.putTitle("MyLabel");
Analytics.with(context).track("MyEventName", trackProperties);

The sdk-segment-integration module contains the Batch integration, and the app module contains an app sample.

Integrating with other Batch features (recommended)

If you want to use this integration, but use other Batch features than Analytics, you may want to follow the standard integration steps, and then add this line in your Application subclass, before any segment call:

BatchIntegrationConfig.enableAutomaticLifecycleManagement = false;

This will let your code fully control the configuration of the SDK, and calling of the lifecycle methods. Note that by enabling this, you will have to add Batch.onStart/onStop/onDestroy calls yourself, as indicated by Batch's documentation.

Optional dependencies

This library does not strictly require Firebase to work, but they're recommended. If you don't add the firebase libraries, notifications will not work.

We recommend you add the following to your build.gradle (version 12.0.1 is not strictly required, newer versions are compatible):

implementation "com.google.firebase:firebase-core:12.0.1"
implementation "com.google.firebase:firebase-messaging:12.0.1"

Modifying this library

To contribute on this library, simply use Android Studio as you would with any project.

You can run the unit tests from a CLI using:

./gradlew clean testDebug

at the root of the project.

com.batch.android

Batch.com

The notifications infrastructure of successful mobile apps

Versions

Version
2.0.2
1.0.1
1.0.0