Language:
Page Info
Tags:
Engine Version:

Using Ad Mob In-Game Ads on Android

Choose your OS:

AdMob.png

Configuration

To configure your project to use the AdMob in-game advertisement system on Android:

  1. In the Edit menu in Unreal Editor, select Project Setings to view the configuration options for your project.

  2. On the left, Select the Platforms: Android tab.

  3. In the Google Play Services section, check the Enable Google Play Support option.

  4. Enter the App ID for your game in the Games App ID field.

  5. Add an element to the Ad Mob Ad Unit IDs array for each AdMob ID you want to associate and enter the ID in the text box.

  6. Enter your Google Play License Key in the Google Play License Key field.

    image alt text

    All of these values are available in the Google Play Developer Console for your App and Game Services, or in the Google Ad Mob interface.

  7. Finally, you'll need to add com.android.vending.BILLING to the Extra Permissions array in the Advanced APKPackaging section of the Android settings:

    extraPermissions.png

C++ Projects

If you project is a C++ project you will also need to add the appropriate modules to your Target.cs file, for example:

    ...
    if (Target.Platform == UnrealTargetPlatform.Android)
    {
        ModuleNames.Add("OnlineSubsystemGooglePlay");
        ModuleNames.Add("OnlineSubsystem");
        ModuleNames.Add("AndroidAdvertising");
    }

Look at the Unreal Match 3 Target.cs file, Match3\Source\Match3.Target.cs, to see how this fits into the entire file.

Showing the Ad Banner

The Show Ad Banner function is used to display an ad banner in your game. Call it somewhere in the logic where you want to show an ad, such as when the main menu is shown.

In Blueprints:

The example below is from the Unreal Match 3 sample game, which displays an ad banner when the victory/defeat screen is shown using the Construct event of that Widget Blueprint:

show_ad.png

See the Show Ad Banner reference for more information on the node.

Hiding the Ad Banner

The Hide Ad Banner functions hides the visible ad banner. Call it when you no longer want the ad to be displayed, such as when you exit the main menu.

In Blueprints:

The example below is from the Unreal Match 3 sample game, which hides the ad banner when the victory/defeat screen is exited using the Destruct event of that Widget Blueprint:

hide_ad.png

See the Hide Ad Banner reference for more information on the node.