Skip to content

Android Project Setup

Aleksandr Chatsky edited this page Feb 4, 2019 · 21 revisions

1. Add the Appmediation SDK to your project

  1. You can download our SDK with all required libraries here.

  2. Unzip the archive to your app library folder (example: my_project\app\libs)

  3. Add all unzipped libraries in your app Gradle file (how to do that: read more)

  4. Add play-services-ad, appcompat-v7 and recyclerview libraries to your project:

    dependencies { 
        compile 'com.android.support:appcompat-v7:26.1.0' 
        compile 'com.android.support:recyclerview-v7:26.1.0' 
        compile 'com.google.android.gms:play-services-ads:15.0.1' 
    }
    

2. Enable Multidex

Our Single SDK is composite of all top demand partner SDK’s and as a result, contains a lot of different libraries which requires multidex feature. You can learn more about multidex and how to enable it here.

3. Setup Manifest

Most of manifest settings will be added automatically by the Gradle manifest merger and following manifest elements need to add manually. Add elements that are between '<!-- Appmediation -->' comments.

<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
  package="your.package.name">  
   
 <application  
  android:icon="@mipmap/ic_launcher"  
  android:label="@string/app_name"
  android:usesCleartextTraffic="true">  
  
 <activity  
  android:name=".MainActivity"  
  android:label="@string/app_name">  
     <intent-filter> 
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />  
     </intent-filter>
 </activity>
  
 <!-- Appmediation -->  
 <!-- Mobvista -->
 <receiver android:name="com.mintegral.msdk.click.AppReceiver"
    android:enabled="@bool/isLessThenApi28" >
    <intent-filter>
       <action android:name="android.intent.action.PACKAGE_ADDED" />
       <data android:scheme="package" />
    </intent-filter>
  </receiver>
  
 <!-- StatApp -->  
 <receiver android:name="com.startapp.android.publish.common.metaData.BootCompleteListener">
    <intent-filter>
       <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
 </receiver>  
 
 <!-- BAIDU -->  
 <meta-data
    android:name="app_license"
    android:value="your_baidu_license" />

 <provider
    android:name="com.duapps.ad.stats.DuAdCacheProvider"
    android:authorities="${applicationId}.DuAdCacheProvider"
    android:exported="false"
    android:enabled="@bool/isLessThenApi28" />
 <!-- Appmediation -->  
 
 </application>  
</manifest>

P.S: To get your Baidu license key please contact your Appmediation manager or write to support@appmediation.com
P.S: Since not all our partners support encripted comunication we recomend to enabling cleartext in your application. To do that please add android:usesCleartextTraffic="true" to you application in your manifest file.
P.S: If you are using AdMob version 17.0.0 or higher then you are required to specify a <meta-data> tag with key com.google.android.gms.ads.APPLICATION_ID in your AndroidManifest.xml. Example:

<manifest>
    <application>

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ADMOB_APP_ID"/>

    </application>
</manifest>

P.S: If you are not using Gradle build system then please replace the ${applicationId} with your application package name.

Clone this wiki locally