简体   繁体   中英

What changes are required in admob AdRequest code before publishing android app?

I am about to publish my app I made on unity. I have integrated admob code with my app, have tested ads on my phone, and it is working fine. But I am confused if the ads will work fine for users in other countries.

My question is: What changes need to be made in admob code before publishing the app to playstore.

I have browsed the internet and Stack Overflow, there are similar questions, but the answers are dispersed, and i fear i might miss something. I would like to have a compilation of things that need to be fixed related to admob before publishing my app. Here's what I know so far: 1. If I have created the UnitID in admob by adding my app manually, I need to link it to the app after it has been published. 2. I need to make changes to AdRequest code (code provided below).

public AdRequest createAdRequest()
   {
      return new AdRequest.Builder()
      .AddTestDevice(AdRequest.TestDeviceSimulator)
      .AddTestDevice("0123456789ABCDEF0123456789ABCDEF")
      .AddKeyword("game")
      .SetGender(Gender.Male)
      .SetBirthday(new DateTime(1985, 1, 1))
      .TagForChildDirectedTreatment(false)
      .AddExtra("color_bg", "9B30FF")
      .Build();
   }

Here's the complete code for admob that I've used: https://github.com/googleads/googleads-mobile-plugins/blob/master/unity/samples/HelloWorld/Assets/GoogleMobileAdsDemoScript.cs

I have not made any changes to it. Is there anything that needs to be added/deleted/changed in the AdRequest.Builder() to make sure the ads are relevant to the user? ( I know the argument to AddTestApp() needs to be changed, but should i remove it before publishing my app? ). And I've noticed there is no variable for "location" in this code. Would it make any difference, or does admob automatically work out the location of the user without the programmer having to worry about it?

I would change:

public AdRequest createAdRequest() {
   return new AdRequest.Builder()
   .AddTestDevice(AdRequest.TestDeviceSimulator)
   .AddTestDevice("0123456789ABCDEF0123456789ABCDEF")
   .AddKeyword("game")
   .SetGender(Gender.Male)
   .SetBirthday(new DateTime(1985, 1, 1))
   .TagForChildDirectedTreatment(false)
   .AddExtra("color_bg", "9B30FF")
   .Build();
}

To:

public AdRequest createAdRequest() {
   return new AdRequest.Builder()
   .AddTestDevice(AdRequest.TestDeviceSimulator)
   .AddTestDevice("0123456789ABCDEF0123456789ABCDEF")
   .Build();
}

This way you are not filtering your ads per say but allowing for the greatest possible fill rate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM