Mob SDK V4


Mobibox android SDK is the Global solution for mobile advertising, tracking and in app subscriptions.
Mobibox SDK allows charging users in a clear and simple way. It doesn’t require users to have a credit card or bank account to subscribe to premium features of the application that integrates this SDK.

According to the payment method, users enter their cell phone number, receive a text message with a Pin Code or press a button to subscribe and then all virtual charges are automatically charged to the user’s cell phone bill (charging fees will be clearly communicated to users in the disclaimer).

In parallel, Mobibox SDK measures the effectiveness of the application promotion campaigns that integrates it by tracking the installs and in-app events (such as subscriptions and sign-ups) and see how many of these conversions are being driven by the advertising networks.
It is possible to tag any event in the application to be tracked as a conversion. Whenever users perform the tagged action, the event is recorded and can be viewed in campaign reports.

After Google's recent update to their User Data and Permissions policies, they have restricted access for SMS and Call Log permissions. As an alternative to SMS READ/RECEIVE permissions, we will depend on SMS Retriever API. As for SMS SEND/WRITE permissions, we will use SMS Intent to initiate SMS text messages.
Please follow the below documentation to integrate Mobibox SDK.

Basic Integration

Download SDK

Download Mobibox sdk 4 from link

 Add Mobibox SDK to your android project

  • Goto File -> New -> New Module -> then select Import .JAR/.AAR Package

  • After that it will ask you for AAR path, so select the sdk path and click on finish.

  • Then it will take few second to add it on your project

  • Here you can see modules and you need to select  host app like in screenshot

  • Then you need to click on Dependencies tab, you can see there list of dependencies

  • In that tab you need to click on + icon and then click in Module dependency like below screenshot

  • There you can see AAR file and you need to select it and click ok on dependency dialog then also click on ok on project structure dialog.

  • After that it will take few second to sync project.

  • After sync finish you need to open app level gradle file where you can see below line :

 implementation project(':sdk-4.100')

Additional Dependencies for the project

implementation ''
implementation ''
implementation ''
implementation ''
implementation '[4,5)'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation ''
implementation ''
implementation ''
implementation '' implementation ''
implementation '' mplementation ''
implementation 'com.adjust.sdk:adjust-android:4.12.4'
implementation ''
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation project(':sdk-4.013')

Add Following lines to your top level gradle

allprojects {
repositories {

In case if you are using proguard rules then you need to add below rules in proguard-rules file:

-dontwarn io.branch.**

-dontwarn javax.annotation.**

-keepattributes Exceptions

-dontwarn okhttp3.**

-keep class okhttp3.** { *; }

-dontwarn okio.**

-dontwarn javax.annotation.Nullable

-dontwarn javax.annotation.ParametersAreNonnullByDefault

Add permissions

In the Package Explorer open the AndroidManifest.xml of your Android project and add the following permissions.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add Intent filter to receive SMS

To support auto-detection of Pin code for DCB subscriptions, we need to be able to listen to incoming SMS. In order to do this, we will add a <receiver> to register a broadcast receiver to the manifest XML. We will also add an <intent-filter> to let Android know that we want to launch a specific class when an SMS comes in.
<receiver android:name= "com.mob.sdk.broadcast.MA_MessageReceiver"
<action android:name=""/>

Add Broadcast Receivers for tracking

Whenever your app is installed on a device, Android broadcasts an Intent containing the Google Play Install referrer. This is an important attribution value which must be passed into Mobibox SDK.
You'll need to configure a BroadcastReceiver which listens for this Intent. This can be done by adding receiver tag inside the application tag in your AndroidManifest.xml.
<!-- Branch install referrer tracking -->
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
<action android:name="" />

android:exported="true" >
<intent-filter android:priority="1000">
<action android:name="" />

Since your app contains SDK which needs to know about the Google Play Referrer, you should implement your own BroadcastReceiver. This custom BroadcastReceiver should extract the referrer from the Intent and pass it into each SDK like below:

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.mob.sdk.broadcast.MA_CampaignTrackingReceiver;

public class InstallReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {

new MA_CampaignTrackingReceiver().onReceive(context, intent);

// Google Analytics
new CampaignTrackingReceiver().onReceive(context, intent);


Add google-services.json

1-Add google-services.json file to your project.

2- Add the below in app level build.gradle
apply plugin: ''

3- Add the below in top level build.gradle in dependencies
dependencies {
        classpath ''
        classpath ''

Basic Setup

a. Define set of keys and identifiers related to your app by adding the following meta-data tag inside the <application> element in AndroidManifest.xml.

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />

<meta-data android:name="com.mob.ServiceId" android:value="@string/serviceId"/>
<meta-data android:name="com.mob.ClientGuid" android:value="@string/ClientGuid"/>
<meta-data android:name="com.mob.ClientKey" android:value="@string/ClientKey"/>
<meta-data android:name="com.mob.AppToken" android:value="@string/appToken" />

<!-- Branch init -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="@string/branch_key_live" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="@string/branch_key_test" />

<!-- Branch testing (TestMode "true" to simulate fresh installs on dev environment) -->
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />

<!-- campaignId is used only in case of offline campaigns -->
<meta-data android:name="com.mob.Apk_CampaignId" android:value="@string/ApkCampaignid"/>

b. Fill in the values of your keys and identifiers in strings.xml file. (To be provided by MobileArts).

<string name="serviceId"></string>
<string name="ClientGuid"></string>
<string name="ClientKey"></string>
<string name="appToken"></string>
<string name="facebook_app_id"></string>

<string name="ApkCampaignid"></string>

<!-- Branch App Links -->
<string name="host_app_url"></string>
<string name="host_app_test_url"></string>
<string name="host_app_amazon_url"></string>
<string name="branch_key_live"></string>
<string name="branch_key_test"></string>

c. Inside the<application> element in AndroidManifest.xml, define the below activities used from Mobibox SDK (Subscription related activities).

<activity android:name=".SplashSceenActivity"
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="mobilearts" android:host="open" />
<category android:name="android.intent.category.DEFAULT" />

<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" android:host="@string/host_app_url" />
<data android:scheme="https" android:host="@string/host_app_test_url" />
<data android:scheme="https" android:host="@string/host_app_amazon_url" />

android:configChanges="orientation|screenSize|keyboard|keyboardHidden" >



Initialize the Branch

We recommend using a global android Application class to initialize Branch. If you don't have one in your app already, follow these steps:

a. Create a class “GlobalApplication” that extends Application.
b. Open the AndroidManifest.xml file of your app and locate the <application> element.
c. Add the attribute android:name and set it to the name of your new application class
prefixed by a dot, so the manifest file is configured as:


d. In your Application class find or create the onCreate method and add the following code to initialize the Branch. 

import android.content.Context;

import io.branch.referral.Branch;

public class GlobalApplication extends Application {

protected void attachBaseContext(Context base) {

public void onCreate() {
// Branch logging for debugging

// Branch object initialization

        Initialize the SDK

We recommend using a SplashActivity class to initialize Mobibox SDK. 

a. We recommend using an Utility class to handle preference and global functions. If you don't have one in your app already, follow these steps:
    1. Create a Class "
    2. Add the following function on it.

public static void setDeeplinkUser(Context context, final boolean value){
// Save boolean value on preference
public static boolean isDeeplinkUser(Context context){
// read boolean value from preference
// you can use this function for check, is user if from deeplink or not.
//true : Deeplink user
//false : Organic user
return PreferenceData.getBooleanPrefs(PreferenceData.KEY_IS_DEEPLINK_USER,context);


public static boolean getFireAD(final JSONObject deeplinkObj){
try {

if (deeplinkObj != null && deeplinkObj.has("firead") && deeplinkObj.get("firead").toString().equalsIgnoreCase("false")) {
return false;

return true;

}catch (Exception e){
return true;

b. In your SplashActivity class find or create the onStart method and add the following code to initialize the Mobibox SDK. Depending on whether you build your app for testing or for production, you must enable or disable logs when initializing Mobibox SDK by setting the second parameter to true or false.

protected void onStart() {
// Branch init
Branch.getInstance().initSession(new Branch.BranchReferralInitListener() {
public void onInitFinished(JSONObject referringParams, BranchError error) {

if (error == null) {

Log.e("BRANCH SDK", referringParams.toString());
// latest
JSONObject sessionParams = Branch.getInstance().getLatestReferringParams();
Log.e("sessions params :",sessionParams.toString());

} else {
Log.e("BRANCH SDK", error.getMessage());
// Start your task from here

}, this.getIntent().getData(), this);


public void onNewIntent(Intent intent) {
public void processDeepLinkParams(JSONObject deeplinkObj){
try {
if (deeplinkObj.has("OpenPage") && deeplinkObj.get("OpenPage").toString().equals("BActivity")) {
this, deeplinkObj.toString().replace("\\",""));
String language = Locale.getDefault().toString();
final boolean fireAd = Utility.getFireAD(deeplinkObj);
Log.e("jprocessDeepLinkParams", "fireAd: "+fireAd);
MobiboxConfig config = new MobiboxConfig(this, false, language,fireAd);


}catch (JSONException e){
Log.e("json problem",e.toString());


private void navigateSample() {
if (Utility.isNetworkAvailable(SplashSceenActivity.this)) {

if (MA_BInfo.getBStatus(SplashSceenActivity.this)) {
} else if(Utility.isDeeplinkUser(SplashSceenActivity.this)) {
Intent intent = new Intent(SplashSceenActivity.this, MA_BActivity.class);
startActivityForResult(intent, SDK_CODE);
} else {

private void callLookupSample() {
lookup = new MA_Lookup(SplashSceenActivity.this);

private void gotoSample() {

Intent browserIntent = new Intent(SplashSceenActivity.this, HomeActivity.class);

Billing setup

a. Use the below code, anywhere in your code to open Billing Activity for your user.
private final int SDK_CODE = 11; 

Intent intent = new Intent(context, MA_BActivity.class); 

b. In the same activity where you opened the billing activity, call onActivityResult to check if payment was successful or not.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == SDK_CODE) {
      if(resultCode == RESULT_OK){
         if (MA_BInfo.getBStatus(Context)) {
            //User has successfully subscribed
         } else {
            //User did not subscribe
      if (resultCode == RESULT_CANCELED) {
         //User did not subscribe

Billing lookup

a. To check if user has subscribed (premium) or not through Mobibox SDK when using the app, you can check the below locale variable.
if (MA_BInfo.getBStatus(Context)) {
   //User has successfully subscribed
} else {
   //User did not subscribe
If user is premium according to the locale variable above, you can check the real-time billing status on the backend of the subscribed user by calling the lookup function (lookup on MSISDN). The activity to call this function, should implement MA_OnLookUp

MA_Lookup lookup = new MA_Lookup(Context);

b. The lookup result will give a clear idea about user’s status, which allow you to handle the permissions as you wish.

public void lookupResult(int status, String Description, Boolean isTrial, String sDate, String eDate) {

   Logcat.e(tag, "User status: " + status + " description: " + Description);
   try {
      //Status values:
      //0 for active users - subscribed and billed users
      //1 for none active users - subscribed users but not billed due to low balance
      //2 for deleted users - unsubscribed users => Open billing Activity
      //3 user not found => Open billing Activity
   } catch (Exception e) {
      //Exception occurred, manage the case as you wish
Billing Information

Mobibox SDK provides additional billing information such as: AccountDetails and how to unsubscribe from the app. These are only applicable if the user is premium.

a. showUnsubDialogFromAPI

b. showMyAccountFromAPI

Custom Events tracking

SendEvent Function can be called for tracking any event or action you want to track (events should be defined on Mobibox interface first). In the example below, we are tracking whenever user presses on upgrade button.

EventHandler.sendEvent(MA_Constants.UPGRADE_EVENT, tag""""new EventTrackerListener() {
public void onSendEventComplete(JSONObject json) {

public void onSendEventError(String error) {

Free version support

Some apps, may or may not, have support for free version (free features or free content). This property can be set from backend (by country) and SDK will store it locally.
This way, host app can know if there is a free version to be granted to user or not.

if (MA_BInfo.getIsLimitedLink(context)){
//App has free version, so user can still use the service with limited access
else {
//App does not have free version, and therefor user cannot use the app -> close the app by finishing the activity

Sample project
    For better understanding of the integration of Mob SDK 4, please download the sample project from the link below: