AppLovin Mediation Google Adapter is a plugin that allows developers to integrate the Google Mobile Ads SDK into their iOS apps using the AppLovin Mediation platform. This adapter simplifies the process of displaying Google ads and provides a seamless integration experience for app developers. In this guide, we will provide step-by-step instructions on how to integrate AppLovin Mediation Google Adapter into your iOS app.
Requirements
To successfully integrate AppLovin Mediation Google Adapter, you need to meet the following requirements:
- iOS 9.0 or later
- Xcode 10.0 or later
- Google Mobile Ads SDK
- AppLovin SDK
- An active account with Google AdMob
Integration Steps
Step 1 – Download and Install Google Mobile Ads SDK
The first step is to download and install the Google Mobile Ads SDK. Follow these steps:
- Visit the Google AdMob website and sign in to your account.
- Create a new app or select an existing app that you want to integrate with Google Ads.
- Go to the “Apps” section and select your app.
- Click on “View all apps” and select the platform iOS.
- Click on “Get started” under the “Using Firebase” section and follow the instructions to set up Firebase for your app.
- Once Firebase setup is complete, go back to the app page and click on “Add Firebase to your app” button.
- Follow the prompts and download the “GoogleService-Info.plist” file.
- Copy the downloaded file into your Xcode project.
- Add the Google Mobile Ads SDK dependency to your Xcode project using Cocoapods or manual installation.
- Make sure to import the required frameworks and libraries in your project.
Step 2 – Install AppLovin SDK
If you haven’t already, install the AppLovin SDK by following these steps:
- Visit the AppLovin website and sign in to your account.
- Create a new app or select an existing app that you want to integrate with AppLovin.
- Go to the “Manage Apps” section and select your app.
- Click on “SDK Integration” and follow the instructions to integrate the AppLovin SDK into your app.
- Make sure to import the required frameworks and libraries in your project.
Step 3 – Download and Integrate AppLovin Mediation Google Adapter
To integrate AppLovin Mediation Google Adapter into your app, follow these steps:
- Visit the AppLovin Mediation Google Adapter GitHub repository.
- Click on “Clone or download” and then select “Download ZIP”.
- Unzip the downloaded file and locate the “ALAdapterGoogle.framework” folder.
- Drag the “ALAdapterGoogle.framework” folder into your Xcode project.
- In Xcode, go to your app’s target settings, and under “Frameworks, Libraries, and Embedded Content”, make sure the “ALAdapterGoogle.framework” is present.
Step 4 – Configure AppLovin Mediation Google Adapter
Next, you need to configure the AppLovin Mediation Google Adapter. Follow these steps:
- In Xcode, go to your app’s target settings.
- Add the following keys and values to your app’s Info.plist file:
“`html
“`
“`html
“`
“`html
“`
Replace “YOUR_ADMOB_APP_ID” with your AdMob app ID and “YOUR_APPLOVIN_SDK_KEY” with your AppLovin SDK key.
- In your app’s AppDelegate.swift file, import the necessary frameworks:
“`html
import ALAdapterGoogle
import GoogleMobileAds
“`
- In the application(_:didFinishLaunchingWithOptions:) method in your AppDelegate.swift file, add the following code:
“`html
ALAdapterGoogle.initialize()
GADMobileAds.sharedInstance().start(completionHandler: nil)
“`
Make sure to initialize the AppLovin Mediation Google Adapter and start the Google Mobile Ads SDK.
Usage
Now that you have successfully integrated AppLovin Mediation Google Adapter, you can start displaying Google ads in your app. Here’s how:
“`html
import GoogleMobileAds
class YourViewController: UIViewController, GADBannerViewDelegate {
private var bannerView: GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
// Create a GADBannerView instance.
bannerView = GADBannerView(adSize: kGADAdSizeBanner)
// Set the ad unit ID.
bannerView.adUnitID = “YOUR_BANNER_AD_UNIT_ID”
// Add bannerView to your view hierarchy.
// Load the ad.
bannerView.load(GADRequest())
}
// GADBannerViewDelegate methods…
}
“`
“`html
import GoogleMobileAds
class YourViewController: UIViewController, GADInterstitialDelegate {
private var interstitial: GADInterstitial!
override func viewDidLoad() {
super.viewDidLoad()
// Create a GADInterstitial instance.
interstitial = GADInterstitial(adUnitID: “YOUR_INTERSTITIAL_AD_UNIT_ID”)
// Load the ad.
interstitial.load(GADRequest())
}
@IBAction func showInterstitialAd() {
if interstitial.isReady {
interstitial.present(fromRootViewController: self)
}
}
// GADInterstitialDelegate methods…
}
“`
Replace “YOUR_BANNER_AD_UNIT_ID” with your Google AdMob banner ad unit ID and “YOUR_INTERSTITIAL_AD_UNIT_ID” with your interstitial ad unit ID.
Conclusion
By following the steps outlined in this guide, you have successfully integrated AppLovin Mediation Google Adapter into your iOS app. You can now start displaying Google ads and monetizing your app with the AppLovin Mediation platform. If you encounter any issues or have any questions, please refer to the official AppLovin Mediation Google Adapter documentation or contact the AppLovin support team.