I'm looking to find away to load an admob interstitial ad when my app launches. Just load one initial ad when the app launches. I'm using swift and can't seem to find any forms on how to do this.
import GoogleMobileAds
In Appdelegate Create function
func createAndLoadAd() -> GADInterstitial
{
var ad = GADInterstitial(adUnitID: "ca-app-pub-5018462886395219/7896492088")
var request = GADRequest()
request.testDevices = ["2077ef9a63d2b398840261c8221a0c9b"]
ad.loadRequest(request)
return ad
}
In DidFinishLunchingMethod
self.interstitial = self.createAndLoadAd()
if (self.interstitial.isReady)
{
self.interstitial.presentFromRootViewController(self)
self.interstitial = self.createAndLoadAd()
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.