5

I want to know when using firebase_admob, do I need this code? If so, when releasing an app, what should I write for keywords, contentUrl, and testDevices? I mean, when releasing an app, testDevices is even necessary?

  MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
      keywords: <String>['flutterio', 'beautiful apps'],
      contentUrl: 'https://flutter.io',
      birthday: DateTime.now(),
      childDirected: false,
      designedForFamilies: false,
      gender: MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown
      testDevices: <String>[], // Android emulators are considered test devices
    );
Johnny Baloney
  • 3,409
  • 1
  • 33
  • 37
Daibaku
  • 11,416
  • 22
  • 71
  • 108

2 Answers2

6

this information is used to show ad to users.

You should use keywords related to your application. Ex: if Your application is related to hospital then you can use medicine as your key words.

you can add you web site url if you develop any web site for particular application as contentUrl .

testDevices is a Id of you device in which you are tested. if you want to test your application in real device then you must add test device id because it help you to avoid ad mob bane.

Viren V Varasadiya
  • 25,492
  • 9
  • 45
  • 61
  • So, when you test ads, set test device id by using something like this?(https://pub.dartlang.org/packages/device_id) Plus, should I test real ad before releasing an app? – Daibaku Dec 03 '18 at 17:19
  • you don't need to add all this stuff if you are using only single device for testing purpose. you can find out a device id in your logcat as you run you app while you handset is connected with android studio. – Viren V Varasadiya Dec 03 '18 at 17:45
  • if you are able to display test add with your test id then it is OK if you do not test your real add. if you remove just testDevices then it works as a real and if you click on add then it can ban you ad mob account as google ad mob policy violation(self Click). – Viren V Varasadiya Dec 03 '18 at 17:51
0

MobileAdTargetingInfo class properties mirror the native AdRequest API.

You will find more information about those properties in the documentation for AdRequest.Builder and RequestConfiguration.Builder.

AdRequest.Builder

public AdRequest.Builder addKeyword (String keyword)

Add a keyword for targeting purposes.

public AdRequest.Builder setContentUrl (String contentUrl)

Sets the content URL for a web site whose content matches the app's primary content. This web site content is used for targeting and brand safety purposes.

At the time of writing some parameters from the question have been deprecated with no alternative, some like the one below replaced with a different approach, while some other moved to RequestConfiguration.Builder.

public AdRequest.Builder setIsDesignedForFamilies (boolean isDesignedForFamilies)

Deprecated. Use Ad Content Filtering.

RequestConfiguration.Builder

public RequestConfiguration.Builder setTagForChildDirectedTreatment (int tagForChildDirectedTreatment)

This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA)

public RequestConfiguration.Builder setTestDeviceIds (List testDeviceIds)

Sets a list of test device IDs corresponding to test devices which will always request test ads. The test device ID for the current device is logged in logcat when the first ad request is made.

Johnny Baloney
  • 3,409
  • 1
  • 33
  • 37