Skip to main content

Step 1. Import SDK

// Select mediations and SDKs above

Once that's done, save the file and perform the Gradle sync.

Step 2. Set Up The Project

  1. Add the Network Security Configuration file to your AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application
...
android:networkSecurityConfig="@xml/network_security_config">
</application>
</manifest>
  1. In your network_security_config.xml file, add base-config that sets cleartextTrafficPermitted to true :
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>

Configure Admob Meta-data

note

Only if you use AdMob adapter.

Add your AdMob app id to meta-data tag:

<manifest>
<application>
<!-- Add your AdMob App ID -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>

You may find the AdMob App ID in your personal account on the AdMob page:

Step 3. Initialize SDK

We recommended to call initialization method in your MainActivity - onCreate method only once in your whole app:

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Appodeal.initialize(
context = activity,
appKey = "APP_KEY",
adTypes = adTypes,
callback = object : ApdInitializationCallback {
override fun onInitializationFinished(errors: List<ApdInitializationError>?) {
// Appodeal initialization finished
}
}
)
}
  • context - Activity of your application.

  • Replace APP_KEY with the actual app key from your personal account.

  • adTypes - Ad formats. Initialize only those ad types you want to use:

    • Appodeal.INTERSTITIAL for interstitial;
    • Appodeal.REWARDED_VIDEO for rewarded videos;
    • Appodeal.NATIVE for native ads;
    • Appodeal.BANNER for banners;
    • Appodeal.MREC for 300*250 banners.
Ad types can be combined using or operator.

For example, Appodeal.INTERSTITIAL or Appodeal.REWARDED_VIDEO.


You can find detailed documentation here