我需要发布 Flutter Firebase AdMob 包的哪些 MobileAdTargetingInfo 属性?

Which of the MobileAdTargetingInfo properties of Flutter Firebase AdMob package do I need for release?

我想知道在使用firebase_admob时,我需要这个代码吗? 如果是这样,发布应用时,keywordscontentUrltestDevices应该写什么? 我的意思是,在发布应用程序时,甚至需要testDevices

  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
    );

此信息用于向用户展示广告。

您应该使用与您的申请相关的关键字。例如:如果您的申请与医院有关,那么您可以使用医学作为关键词。

如果您为特定应用程序开发任何网站,您可以添加您的网站 url contentUrl

testDevices 是测试设备的 ID。如果您想在真实设备上测试您的应用程序,那么您必须添加测试设备 ID,因为它可以帮助您避免广告暴徒。

MobileAdTargetingInfo class properties mirror the native AdRequest API.

您将在 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.

在撰写本文时,问题中的一些参数已被弃用,别无选择,其中一些类似于下面的参数,已替换为不同的方法,而另一些则移至 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.