This Android application demonstrates the implementation of various types of Google AdMob ads. The app consists of five buttons, each triggering a specific type of ad using AdMob's test ad IDs.
This project uses test AdMob IDs. For production purposes, generate your own AdMob IDs by visiting the AdMob console.
The app showcases the following types of ads:
- Banner Ad
- A rectangular ad displayed at the top or bottom of the screen.
- Interstitial Ad
- A full-screen ad displayed at natural transition points in the app.
- Rewarded Ad
- An ad that rewards users with in-app items for watching it completely.
- Rewarded Interstitial Ad
- Combines the interstitial ad's full-screen format with the rewarded ad's benefits.
- Native Ad
- An ad that matches the app's look and feel, blending seamlessly into the UI.
Add the following dependency to your build.gradle
file:
dependencies {
implementation 'com.google.android.gms:play-services-ads:22.0.0' // Update to the latest version
}
-
Clone the repository:
git clone https://github.com/yourusername/Ads-Implementation-Android.git
-
Open the project in Android Studio.
-
Add your AdMob App ID to the AndroidManifest.xml:
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/> <!-- Test App ID used here -->
</application>
-
For each ad, provide the respective unit ID. You can replace the test unit IDs with your own production unit IDs when setting up the ads in the app.
-
Build and run the application on a physical device or emulator.
If you have any questions or suggestions, feel free to open an issue or contact me directly.