### Configure allprojects repositories Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Ensure these repository declarations are present within the 'allprojects > repositories' block of your project's build.gradle file to allow Gradle to find necessary dependencies. ```groovy allprojects { repositories { flatDir { dirs 'libs' } google() } } ``` -------------------------------- ### Configure app module repositories for AdMob Adapter Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Make sure the Google and Maven Central repositories are listed in the 'repositories' block of your app-level build.gradle script. This should appear only once for all adapters. ```groovy repositories { google() mavenCentral() } ``` -------------------------------- ### Add dependencies block for libs Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Include this dependency configuration in your app's build.gradle file if you are using a manual download mechanism for JAR files. ```groovy dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) } ``` -------------------------------- ### Set Child-Directed Treatment for AdMob Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Communicate AdMob's child-directed setting to the AdMob network using LevelPlay's setMetaData. Use 'true' for TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE and 'false' for TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE. ```java LevelPlay.setMetaData("AdMob_TFCD","true"); ``` ```java LevelPlay.setMetaData("AdMob_TFCD","false"); ``` -------------------------------- ### Add AdMob Adapter and SDK Gradle Dependencies Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Declare the AdMob adapter and the AdMob mobile SDK as dependencies in your app's build.gradle file to integrate them into your project. ```groovy dependencies { implementation 'com.unity3d.ads-mediation:admob-adapter:5.11.0' implementation 'com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:1.2.1' } ``` -------------------------------- ### Add Internet and Network State Permissions Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Ensure your application has internet access and can check network state by adding these permissions to your AndroidManifest.xml. ```xml ``` -------------------------------- ### Map Content URL for AdMob Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Support Google's content mapping for apps by sharing URLs using the 'Google_Content_Mapping' setting. This can be a single URL or an array of up to 4 URLs. ```java LevelPlay.setMetaData("Google_Content_Mapping","https://www.example.com"); ``` ```java LevelPlay.setMetaData("Google_Content_Mapping",["https://www.example1.com","https://www.example2.com"]); ``` -------------------------------- ### Add AdMob AdActivity to Manifest Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Include the AdMob AdActivity in your manifest to handle ad display. This is required for AdMob integration. ```xml ``` -------------------------------- ### Set Tag For Under Age of Consent for AdMob Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Communicate the Tag For Users under the Age of Consent in Europe (TFUA) request to AdMob using LevelPlay's setMetaData. Use 'true' for TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE and 'false' for TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE. ```java LevelPlay.setMetaData("AdMob_TFUA","true"); ``` ```java LevelPlay.setMetaData("AdMob_TFUA","false"); ``` -------------------------------- ### Set Maximum Ad Content Rating for AdMob Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Set the maximum ad content rating for all ad requests to AdMob using LevelPlay's setMetaData. Possible values include 'MAX_AD_CONTENT_RATING_G', 'MAX_AD_CONTENT_RATING_PG', 'MAX_AD_CONTENT_RATING_T', and 'MAX_AD_CONTENT_RATING_MA'. ```java LevelPlay.setMetaData("AdMob_MaxContentRating","MAX_AD_CONTENT_RATING_G"); ``` -------------------------------- ### Add AdMob App ID to Manifest Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob Declare your AdMob App ID in the AndroidManifest.xml. Replace '[ADMOB_APP_ID]' with your actual App ID. Failure to do so will cause crashes. ```xml ``` -------------------------------- ### Add AdMob App ID to AndroidManifest Source: https://docs.unity.com/en-us/grow/levelplay/sdk/android/networks/guides/google-admob As of Adapter version 4.3.1 onwards, AdMob's SDK requires publishers to add their AdMob App ID to the app's AndroidManifest as a child of the tag. Replace '[ADMOB_APP_ID]' with your actual App ID. ```xml ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.