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!

SDK Installation

STEP 1 - Download

Download MoEngage Unity Package

STEP 2 - Import Assets

Plugins

Click on unity package downloaded above to import it to assets folder under plugins.

The SDK needs a Unity version higher than 5.0.0 to be able to compile as we it requires native plugins for mobile platforms.

STEP 3 - Platform build settings

Switch Platform

Go to build settings under file menu and switch to platform as Android or iOS.

STEP 4 - Platform Specific Settings

Platform Specific Settings

Follow below guidelines for platform specific settings which are mandatory for successfull implementation of MoEngage SDK for Unity Android or Unity iOS.

Android Specific Settings

Configure Manifest File

  1. Configure Meta tags :

APP_ID = App id found under the settings page on the MoEngage dashboard.

    <meta-data
        android:name="APP_ID"
        android:value="[YOUR_APP_ID]"/>

SENDER_ID = The project number as mentioned on GOOGLE CLOUD CONSOLE PROJECTS PAGE

<meta-data
        android:name="SENDER_ID"
        android:value="id:[YOUR_SENDER_ID]"/>

NOTIFICATION_ICON = The notification small icon which will be used to set to notifications posted


    <meta-data
        android:name="NOTIFICATION_ICON"
        android:value="[YOUR_SMALL_ICON]"/>

NOTIFICATION_TYPE = The notification type which will be used, SINGLE OR MULTIPLE. Default behaviour is single, use 2

    <meta-data
        android:name="NOTIFICATION_TYPE"
        android:value=""/>

NOTIFICATION_LARGE_ICON = The notification large icon which will be used to set to notifications posted.

<meta-data
        android:name="NOTIFICATION_LARGE_ICON"
        android:value="[YOUR_LARGE_ICON]"/>

SKIP_GCM_REGISTRATION = false, If you want MoEngage to register for Push Notification, else true.

<meta-data
    android:name="SKIP_GCM_REGISTRATION"
    android:value="false" />
  1. Replace Package names : Replace [YOUR_ APPLICATION_ID] with you application id
<permission android:name="[YOUR_ APPLICATION_ID].permission.C2D_MESSAGE"
      android:protectionLevel="signature"/>


    <receiver android:name="com.moe.pushlibrary.AppUpdateReceiver">
      <intent-filter>
        <action android:name="android.intent.action.PACKAGE_REPLACED"/>

        <data
            android:path="[YOUR_ APPLICATION_ID]"
            android:scheme="package"/>
      </intent-filter>
    </receiver>

    <!-- The underlying content provider -->
    <provider
        android:name="com.moe.pushlibrary.providers.MoEProvider"
        android:authorities="[YOUR_ APPLICATION_ID].moengage.provider"
        android:exported="false"/>
    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
    android:exported="true"
    android:permission="com.google.android.c2dm.permission.SEND" >
    <intent-filter>
      <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
      <category android:name="[YOUR_ APPLICATION_ID]"/>
    </intent-filter>
  </receiver>
  1. Add label and parent activity to MoEActivity
    <activity
        android:name="com.moe.pushlibrary.activities.MoEActivity"
        android:label="[ADD_NAME]"
        android:parentActivityName="[ADD_PARENT_ACTIVITY]">
      <!-- Parent activity meta-data to support 4.0 and lower -->
      <meta-data
          android:name="android.support.PARENT_ACTIVITY"
          android:value="[ADD_PARENT_ACTIVITY]"/>
    </activity>

Replace [ADD_NAME] with label and [ADD_PARENT_ACTIVITY] with the parent activity(if any).

iOS specific settings

  1. First, create a XCode project by building your Unity project in iOS platform under build settings.

  2. Open your XCode project, go to Info.plist of your project and add MoEngage_APP_ID key and assign your APP ID as shown below :

Find your APP ID

To know App ID to be used, login to your MoEngage account, Go to Settings in the left panel. Under App Settings, you will find your APP ID.

  1. Go to Build Settings of the App Target and add -ObjC flag to Other Linker Flags as shown in image below :
  1. After this Enable Objective-C Exceptions in the Build Settings of your App Target as shown below :
  1. We provide Test/ Live environment feature so that you can test all our features in Test environment before going live with your app. To enable test environment you will have to add a preprocessor macro i.e DEBUG. And do the following to achieve it :
    • Select your App target
    • Go to Build Settings
    • Go to Preprocessing Section
    • Add "DEBUG=1" Preprocessor Macro for Debug as shown below :

Use Test Environment

To use Test environment of MoEngage, Build your iOS build by selecting Debug for Run in XCode in Unity Build Settings.

SDK Installation