Steps to Install your Android Installation

Installing the EF Network package allows you to unlock a world of onward journeys for your customers, all served natively within your Android applications. The EF Network library supports Android 5.0 with a minSDK of 26, built using 2021.2.1 Chipmunk.

To review the latest version of the SDK, see this release schedule: https://github.com/mmob-tech/mmob-client-android/releases

Installing your Android Integration

mmob package name is called MmobClient

To install an mmob Integration, the following steps are required:

  • Import MmobClient

  • Set the configuration with your organisation's cp_id and integration_id

  • Configure the customer snippet

  • Ensure you are operating off the correct instanceDomain for your region

  • You may also add locale for the user's preferred language under configuration


Step 1: Import the Client

To get started, add jitpack at the end of the repositories in your root build.gradle:

allprojects {
  repositories {
  ...
    maven { url 'https://jitpack.io' }
  }
}

In your app build.gradle, add the import and sync:

dependencies {
  implementation 'com.github.mmob-tech:mmob-client-android:main-SNAPSHOT'
}

Step 2: Create webView Reference

In app activity_mail.xml, create a reference to a web_view under an alias 'mmob_view':

<WebView
    android:id="@+id/mmob_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
/>

Step 3: Initialise the Client and Webview

In your snippet host app (e.g. activity_main.xml), initialise the client and webView:

val mmobView: MmobView = findViewById(R.id.mmob_view)

val client = MmobClient(mmobView, applicationContext)

Step 3.1: Set your Instance Domain to the Correct Region

If you are operating in the Asia Pacific region, ensure to add InstanceDomain.EFNETWORK to your val client parameters. If you do not set an InstanceDomain, the system will default to a different server and your deployment will not function.

val client = MmobClient(mmobView, applicationContext, InstanceDomain.EFNETWORK)

Step 3.2: Set your Environment

environment should only be set to stag in the case that you are deploying to your UAT/Staging environment. If you are deploying to production, our system will automatically point to our production server and environment does not need to be specified.

Step 4: Point the Script to the Correct Identifier

A. If you are a Distribution Partner (embedding services into your platform), your configuration will use an cp_deployment_id and cp_id and look like the following:

val integration = MmobClient.MmobIntegrationConfiguration(
  cp_id = **your CP id**
  cp_deployment_id = **your integration id**
)

If you are unsure about any of the id options above, please contact your account manager who will be able to confirm.

Language selection

Integrations serve content using the locale en_GB by default. In order to change language you may pass an optional locale argument:

val integration = MmobClient.MmobIntegrationConfiguration(
  cp_id = **your CP id**
  cp_deployment_id = **your integration id**
  locale = "ms_MY" // request content in Malay language
)

Note that not all products are translated to all languages. Be sure to contact our Customer Support to request translations in the language(s) you intend to use before using the locale parameter.

Step 5: Set the customerInfo Snippet

Configure the customerInfo snippet with the correct parameters:

val customerInfo = MmobClient.MmobCustomerInfo(
  customerInfo = MmobClient.MmobCustomerInfo.Configuration(
    email: "john.smith@example.com"
    first_name: "John"
    surname: "Smith"
  )
)

Anonymous Users

If your organisation does not wish to pass in any data to the snippet, this part of the snippet can be left as follows:

customerInfo = MmobClient.MmobCustomerInfo.Configuration()

For anonymous users (users for whom you do not have a suitable GUID such as an email), do not pass in a non-unique placeholder email. Instead, ensure that the email field is left blank each time an anonymous user starts a journey.

Step 6: Call the Client

Call the client to update the view:

client.loadIntegration(integration = integration, customerInfo = customerInfo)

Your Final Script Should Appear as Follows:


package com.mmob.efhub

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.mmob.mmob.client.MmobClient
import com.mmob.mmobclient.MmobView

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val mmobView: MmobView = findViewById(R.id.mmob_view)

        val client = MmobClient(mmobView, applicationContext, InstanceDomain.EFNETWORK)
        // note that if operating in the APAC Region, InstanceDomain.EFNETWORK should be used. If not, do not include `InstanceDomain`

        val integration = MmobClient.MmobIntegrationConfiguration(
            cp_id = "cp_DhskfrQ5V0HLfcVwbl54Q",
            cp_deployment_id = "cpd_aWYxkROUFpqW0GklMEtBz"
            locale = "en_GB"
        )

        val customerInfo = MmobClient.MmobCustomerInfo(
            customerInfo = MmobClient.MmobCustomerInfo.Configuration(
                email = "corey.hudson@example.com",
                first_name = "Corey",
                surname = "Hudson",
                gender = "male",
                title = "Mr",
                building_number = "8",
                address_1 = "Brandon Grove",
                town_city = "Newcastle Upon Tyne",
                postcode = "NE2 1PA",
                dob = "1946-03-26T20:49:19.388Z"
            )
        )

        client.loadIntegration(integration = integration, customerInfo = customerInfo)
    }
}

Was this page helpful?