Created
October 20, 2023 09:36
-
-
Save kishan-vadoliya/5b3abaa0984fa2ca5bbfce2707ccefbc to your computer and use it in GitHub Desktop.
Android’s Jetpack Compose and Admob ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Integrate AdMob SDK: | |
// TODO: Add the following dependency to your app’s build.gradle file | |
implementation 'com.google.android.gms:play-services-ads:22.4.0' | |
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 --> | |
<meta-data | |
android:name="com.google.android.gms.ads.APPLICATION_ID" | |
android:value="ca-app-pub-3940256099942544~3347511713" /> | |
class MainActivity : ComponentActivity() { | |
@OptIn(ExperimentalMaterial3Api::class) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
MobileAds.initialize(this) {} | |
MobileAds.setRequestConfiguration( | |
RequestConfiguration.Builder().setTestDeviceIds(listOf("ABCDEF012345")).build() | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment