MoEngage Docs

Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Android Integration

Integrating MoEngage with Segment in Android

SDK Installation

Follow these steps to install the MoEngage SDK into your Android app.

MoEngage depends on play services location library for Geofencing and other location related information. Please add the location library if you need to use Geofencing.

**MoEngage checks for location permission and if it is available, then gets and sets geofences

Adding Dependency

Add segment's bundled library dependency in the app's build.gradle

dependencies {
    compile ''
    compile('com.moengage:moengage-segment-integration:2.0.00') {
        transitive = true

Initializing Segment and MoEngage

pplication subclass initialize Segment and tell segment that you are using MoEngage bundled with Segment. Add the following code snippet in your Application class.

public class SegmentDemoApplication extends Application {
  public void onCreate() {
    Analytics analytics = new Analytics.Builder(getApplicationContext(),
            "xMESvGwLPeCwurQ4yY9fv3iaHlredqVC")//use your own write key
    .logLevel(Analytics.LogLevel.VERBOSE)// should be added only in debug builds. Make sure this
    // is removed before a signed apk is generated.
    .use(MoEngageIntegration.FACTORY)//enable MoEngage integration

    Analytics.setSingletonInstance(analytics);//recommended as creating a new instance every time
    // is expensive in terms of resources used


Tracking User Attributes

Analytics.with(MainActivity.this).identify("user attributes", new Traits().putFirstName("Umang").putGender("Male"),  null);

To know more about tracking user attributes you can refer this link

Tracking Events using Segement

Analytics.with(MainActivity.this).track("Email button Click", new Properties().putValue("email", "opened"));

To know more about tracking events you can refer this link

Configuring MoEngage SDK

For configuring the MoEngage SDK further refer to this link.

Sample Implementation

Further refer to this github repository for sample implementation

Android Integration

Integrating MoEngage with Segment in Android