Get Started


The YaftaMobile Android SDK makes it easy to integrate high-quality ads into your android apps.

This guide describes how to integrate the YaftaMobile SDK with your Android app.

Download the latest release of YaftaMobile's SDK for Android here


The YaftaMobile Android SDK requires a run-time of Android 4.0.3 (API Version 15) and up.

The YaftaMobile Android SDK requires the Google Play Services, 4.0 or higher, library to function. This is to comply with the Google Play content guidelines for collecting the advertising identifier. To add the SDK, please follow the official Integration Instructions.


Step 1: Add the SDK to your Project

To use the YaftaMobile Android SDK, you have two options. You can install it automatically using Gradle's Dependency Management or manually install it by including the SDK source code in your project.

- Install using Gradle

The simplest way to integrate the SDK into your project is by using Gradle’s Dependency.

- Manual Install

If you are not using Gradle, you can download and unzip the Yaftamobile SDK. Copy the JAR file (YaftaMobileAndroidSDK-x.x.x.jar) to the /libs directory of your project and then add it as dependency to your project. As an example, for projects using Eclipse IDE, follow the steps below:

  1. Copy the YaftaMobileAndroidSDK-x.x.x.jar file to your project’s libs folder.
  2. Right-click on YaftaMobileAndroidSDK-x.x.x.jar file and select Build Path > Add to Build Path.

Add JAR to Build Path in Eclipse

To install using Gradle, add this to Module-level /app/build.gradle before dependencies:

repositories {


Then add the compile dependencies: 

dependencies {
implementation ''
implementation ''
implementation ''

Step 2: Add permissions

Making ad requests requires the INTERNET and ACCESS_NETWORK_STATE permissions to be declared in your AndroidManifest.xml file.

These permissions need to be declared outside of the <application…>  tag.


Step 3: Set Your AppID

In order to fetch ads, you must set your AppID. This allows YaftaMobile to track your app impressions and clicks, and associate them with your account.

Open the AndroidManifest.xml file and add a 'Meta Data' item called com.mustmara.yaftamobile.sdk.appid, with a value of your AppID that is shown on the dashboard site.

Within the <application...> tag, add the following:


Step 4: Add YaftaMobileBannerView

To retrieve and display banner ad, you will use an instance of YaftaMobileBannerView, which can be created either in code or XML.The easiest way to incorporate banner ad is to simply define your YaftaMobileBannerView as you would any other part of your res/layout/main_layout.xml.

Add the yaftamobile namespace to the root Layout into the xml file in res/layout/:

<RelativeLayout xmlns:android=""


Then add the YaftaMobileBannerView to the layout: 

yaftamobile:adSize="S320X50" />

Step 5: Verify SDK Integration

To verify that the SDK has been properly integrated, use the RunMode.TEST to inform the SDK to fetch test ads then call requestAd() method to load and display the ad.

Once you have completed these steps, you can run your application and you should see a test banner displayed on the screen

Place the following code in order to display an ad on the screen:

import com.mustamara.yaftamobile.sdk.*;
public void onCreate(...) {

YaftaMobileBannerView bannerView;
bannerView= (YaftaMobileBannerView)findViewById(;
AdRequest adRequest=new AdRequest();


Advanced Settings


During development and testing of the YaftaMobile Android SDK, you should indicate all ad requests are for testing. Test requests will not show up in your metrics.

Note: Ensure that you set the Mode to RunMode.LIVE when distributing the app to users. By default, Mode is set to RunMode.LIVE 

ProGuard Support

If you are building your app using ProGuard, you need to add the following code to your Proguard configuration, so that our SDK will not be obfuscated twice.

Request test ads by setting the test run mode


Add these ProGuard flags to your Proguard configuration file

-keep public class com.mustamara.yaftamobile.sdk.** {*;} 
-keep public interface com.mustamara.yaftamobile.sdk.** {*;}
-dontwarn com.mustamara.yaftamobile.sdk.**
Next Steps
  • See Banner Ads for more settings.
  • Explore our code sample on GitHub which demonstrate how to load an ad.