AdMob Android Adapter

1280px-Google_AdMob_logo.svg.png

This guide is directed to Publishers interested in integrating the Start.io (Formerly StartApp) Android SDK using AdMob as the mediating network.

NOTES:
  • The code samples in this document can be copy/pasted into your source code
  • Feel free to take a look at our Sample Project to help you during the integration process.
  • If you have any questions, contact us here.

Prerequisite for adapter integration: 

AdMob is set as your mediation network

The following manual assumes you are already familiar with the AdMob Mediation Network and have already integrated the Google Mobile Ads SDK into your application with at least one Ad Unit. Otherwise, please start by reading the following articles for a walk-through explanation of what mediation is, how to use the AdMob Mediation UI, and instructions on how to add AdMob mediation code into your app.

You application is defined in your Start.io Account

At this point we assume that you have already added your application to your Start.io (Formerly StartApp) account, in case you haven't, please follow the following steps:

  1. Login into your Start.io Publisher's account
  2. Add your application and get its App ID

For any questions or difficulties during this process, please contact us here.

Step 1 - Integrating the AdMob Mediation Adapter

Add the AdMob adapter dependency

dependencies {
    implementation 'io.start:admob-mediation:3.+'
}

Step 2 - Configure Mediation Settings

1. Please log in to your AdMob account in order to add Start.io (Formerly StartApp) to the mediation configuration. 

2. Create new or edit existing Mediation Group, then click Add custom event.

Step 1

  1. Fill the fields Label and Manual eCPM, then click Continue.

Step 2

  1. Create a mapping for each ad unit.

Step 3

  • Fill the fields Mapping name, Class Name and Parameter, then click Done.
  • Make sure to change string YOUR_APP_ID with the actual app ID from the portal.start.io.
  • Mapping name: Start.io
  • Class Name: io.start.mediation.admob.StartIoAdapter
  • Parameter: { appId : 'YOUR_APP_ID' }
  • Advanced option: Pass adTag to the parameter: { appId : 'YOUR_APP_ID', adTag: 'YOUR_AD_TAG' }

Step 4

  1. Select a mapping, then click Done.

Step 5

  1. Make sure new ad source is appeared in list, then click Save.

Step 6

 

Step 3 - Configure Start.io Ad Units

On the next screen: "Map ad units: StartApp" please define the following Class Name:
 com.startapp.mediation.admob.StartappAdapter

CustomEvent_Sample.png

Step 4 - AdMob Ad Unit advanced Configuration

There are several parameters for each Ad Unit which can be configured from the AdMob Portal or from the code. 

All the parameters mentioned below are optional and should be set based on your monetization strategy and criteria.

NOTES:
  • Everything defined from the AdMob Portal will override the parallel configuration made through the code.
  • All configurable parameters must be set in Json format and under the relevant custom event class, note that you can choose to configure non to any of the available parameters.

Interstitial Settings: 

Through the AdMob Portal:

{"AppId": "YOUR_APP_ID", "adTag":"interstitialTagFromServer", "interstitialMode":"OVERLAY", "minCPM":0.02, "muteVideo":false}  

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("interstitialTagFromAdRequest")
	.setInterstitialMode(StartappAdapter.Mode.OFFERWALL) // can be VIDEO and OVERLAY as well
	.muteVideo()
	.setMinCPM(0.01)
	.toBundle();
  
interstitial.loadAd(new AdRequest.Builder()
   .addCustomEventExtrasBundle(StartappAdapter.class, extras)
   .build());  

Banner Settings: 

Through the AdMob Portal:

{"AppId": "YOUR_APP_ID", "adTag":"bannerTagFromServer", "minCPM":0.02, "is3DBanner":false} 

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("bannerTagFromAdRequest")
	.enable3DBanner()
	.setMinCPM(0.01)
	.toBundle();

banner.loadAd(new AdRequest.Builder()
	.addCustomEventExtrasBundle(StartappAdapter.class, extras)
	.build()); 

Rewarded Video Settings: 

Through the AdMob Portal:

{"AppId": "YOUR_APP_ID", "adTag":"rewardedTagFromServer", "minCPM":0.02, "muteVideo":false} 

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("rewardedTagFromAdRequest")
	.muteVideo()
	.setMinCPM(0.01)
	.toBundle();

rewarded.loadAd(new AdRequest.Builder()
	.addNetworkExtrasBundle(StartappAdapter.class, extras)
	.build(), loadCallback);

Native Settings: 

Available sizes are:
SIZE72X72, SIZE100X100, SIZE150X150, SIZE340X340, SIZE1200X628, SIZE320X480, SIZE480X320

NOTES:
  • The code sample below uses a specific AdSize as a sample,  you can replace the sizes on the sample code with any of the supported AdSizes by Start.io (Formerly StartApp).

Through the AdMob Portal :

{"AppId": "YOUR_APP_ID", "adTag":"nativeTagFromServer", "minCPM":0.02, "nativeImageSize":"SIZE150X150", "nativeSecondaryImageSize":"SIZE340X340"}

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("nativeTagFromAdRequest")
	.setMinCPM(0.01)
	.setNativeImageSize(StartappAdapter.Size.SIZE72X72)
	.setNativeSecondaryImageSize(StartappAdapter.Size.SIZE150X150)
	.toBundle();

loader.loadAd(new AdRequest.Builder()
    .addCustomEventExtrasBundle(StartappAdapter.class, extras)
    .build());
Step 5 - Optional - Ad Inspector

This is an Optional step. Ad inspector is an in-app overlay that enables authorized devices to perform real-time analysis of test ad requests directly within a mobile app. It is included with the Google Mobile Ads SDK version 20.0.0 and higher, and can be enabled with no coding required. Click here to use the Ad Inspector.

 

 

Congratulation - that's it! You may now run your app and see Start.io (Formerly StartApp) ads in action.

Was this article helpful?
Have more questions? submit a request