Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance AdRequestOptions Extension Functions #161

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

teogor
Copy link
Owner

@teogor teogor commented Oct 27, 2023

This PR introduces enhancements to the extension functions for configuring AdRequestOptions related to ad content ratings and compliance with various app categories.

Changes Made

Refinement of Existing Extension Functions

The existing extension functions for configuring AdRequestOptions have been refined and extended to include additional scenarios. The following extension functions are now available:

  • setForChildrenApp(): Configures options for apps designed specifically for children.
  • setForFamilies(): Configures options for apps targeting families, with support for primarily child-directed and mixed-audience apps.
  • setForEveryoneApp(): Configures options for apps targeting everyone, including children and families.
  • setForTeens(): Configures options for apps targeting teens.
  • setForAdults(): Configures options for apps targeting adults.

These extension functions provide a streamlined way to set the appropriate content rating and treatment options for ads, ensuring compliance with policies and regulations across different app categories.

How to Use

You can utilize the extension functions to configure AdRequestOptions for various app categories as needed. The method for configuring AdRequestOptions depends on your context:

  • If you are within a Composable context, you can access the AdRequestOptions via LocalAdsControl.current:

    val adsControl = LocalAdsControl.current
    adsControl.adRequestOptions.apply {
      maxAdContentRating = AdContentRating.UNSPECIFIED
      tagForChildDirectedTreatment = TagForChildDirectedTreatment.UNSPECIFIED
      tagForUnderAgeOfConsent = TagForUnderAgeOfConsent.UNSPECIFIED
    }
  • If you are outside of a Composable context, you can use AdMob.configureAdRequest:

    AdMob.configureAdRequest {
      maxAdContentRating = AdContentRating.UNSPECIFIED
      tagForChildDirectedTreatment = TagForChildDirectedTreatment.UNSPECIFIED
      tagForUnderAgeOfConsent = TagForUnderAgeOfConsent.UNSPECIFIED
    
      setForFamilies()         // Configure for apps targeting families
      setForChildrenApp()      // Configure for apps designed for children
      setForEveryoneApp()      // Configure for apps targeting everyone, including children and families
    }

Choose the appropriate method based on your context to configure AdRequestOptions for your application's specific requirements.

This allows you to easily set the appropriate ad content rating and treatment options for ads within your application.

@teogor teogor added @priority-critical @feature New feature or request ads Marks an Issue/PR as linked to the ceres:ads module labels Oct 27, 2023
@teogor teogor added this to the 1.0.0-alpha04 milestone Oct 27, 2023
@teogor teogor self-assigned this Oct 27, 2023
@teogor
Copy link
Owner Author

teogor commented Oct 27, 2023

New Features Added:

  • Extension functions for AdRequestOptions to configure settings for different audience age groups.
  • Updated documentation for the new functions.

Compliance with Google Play Service and AdMob Policies:

These extension functions have been designed to ensure compliance with Google Play Service and AdMob policies, especially with regard to the ad content rating and child-directed treatment settings. When using these functions, developers can be confident that their apps meet the required criteria for the specified audience age groups and adhere to both platform's policies.

@teogor teogor merged commit 21575f4 into main Oct 27, 2023
4 checks passed
@zeobot zeobot bot deleted the feature/add-ad-request-options branch October 27, 2023 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ads Marks an Issue/PR as linked to the ceres:ads module @feature New feature or request @priority-critical
Projects
Development

Successfully merging this pull request may close these issues.

1 participant