Skip to content

Latest commit

 

History

History

ios-google-mobile-ads

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

RoboPods for Firebase Google Mobile Ads

Frameworks required for this pod:

  • GoogleMobileAds.xcframework (from Firebase.zip/Google-Mobile-Ads-SDK/GoogleMobileAds.xcframework)
  • UserMessagingPlatform.xcframework (from Firebase.zip/Google-Mobile-Ads-SDK/UserMessagingPlatform.xcframework)
  • GoogleAppMeasurement.xcframework (from FirebaseAnalytics/GoogleAppMeasurement.xcframework)
  • GoogleUtilities.xcframework (from Firebase.zip/FirebaseAnalytics/GoogleUtilities.xcframework)
  • FBLPromises.xcframework (from Firebase.zip/FirebaseAnalytics/FBLPromises.xcframework)
  • nanopb.xcframework (from Firebase.zip/FirebaseAnalytics/nanopb.xcframework)

to use this pod configure your robovm.xml

<config>
    ...
    <frameworkPaths>
        <path>libs</path>  <!-- path where GoogleMobileAds.framework is located -->
    </frameworkPaths>
</config>

Gradle

Add the following dependency to your build.gradle:

repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
   ... other dependencies ...
   implementation "io.github.dkimitsa.robovm:robopods-firebase-google-mobile-ads-ios:$altpodsVersion"
}

Sample code

UIApplicationDelegateAdapter:

@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
    GADMobileAds.sharedInstance().start(status -> {
        GADMobileAds.sharedInstance().getRequestConfiguration().setTestDeviceIdentifiers(new NSArray<>(GADRequest.GADSimulatorID()));
    });
    GADRewardBasedVideoAd.sharedInstance().setDelegate(new GADRewardBasedVideoAdDelegateAdapter() {
        @Override
        public void didReceiveAd(GADRewardBasedVideoAd rewardBasedVideoAd) {
            if (GADRewardBasedVideoAd.sharedInstance().isReady())
                GADRewardBasedVideoAd.sharedInstance().presentFromRootViewController(MyViewController.this);
        }
    });

    // ... other code 
}

Any other place to use GAD:

    GADRewardBasedVideoAd.sharedInstance().loadRequest(new GADRequest(), "ca-app-pub-3940256099942544/1712485313" );

Official website

https://firebase.google.com/docs/admob/ios/quick-start