The Sample Moe Developer Hub

Welcome to the Sample Moe developer hub. You'll find comprehensive guides and documentation to help you start working with Sample Moe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Android Integration

Integrating MoEngage with Segment in Android

SDK Installation

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

com.google.android.gms:play-services-gcm:8.1.0

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 'com.segment.analytics.android:analytics:+'
    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 {
  @Override
  public void onCreate() {
    super.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
    .build();

    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