Posts tagged with admob

I am trying to implement App Tracking Transparency in my app. I tried to do this on first ViewControllor, but it crashes the app after uploading to the test flight.

After this, I found a lot of info that this should be done in appDelegate I did this way. Of course, I have set NSUserTrackingUsageDescription in Info.plist

I tried to figure it out with this post.

In the debugger, I always see "Not Determined". Could anyone please help with this?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         // Override point for customization after application launch.         requestTrackingPermission()         GADMobileAds.sharedInstance().start(completionHandler: nil)         return true     } 

The function

func requestTrackingPermission() {       if #available(iOS 14, *) {         // ATTrackingManager.requestTrackingAuthorization { status in         ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in           switch status {           case .authorized:             // Tracking authorization dialog was shown             // and we are authorized             print("Authorized")                           // Now that we are authorized we can get the IDFA             print(ASIdentifierManager.shared().advertisingIdentifier)                          case .denied:             // Tracking authorization dialog was             // shown and permission is denied             print("Denied")           case .notDetermined:             // Tracking authorization dialog has not been shown             print("Not Determined")           case .restricted:             print("Restricted")           @unknown default:             print("Unknown")           }         }       )}     } 

When I run an iOS app using the AdMob plugin on a device, the console log keep repeating with high frequency.

ProcessThrottler::Activity::invalidate: Ending foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     ProcessThrottler::Activity::Activity: Starting foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     ProcessThrottler::Activity::invalidate: Ending foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     ProcessThrottler::Activity::Activity: Starting foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     ProcessThrottler::Activity::Activity: Starting foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     ProcessThrottler::Activity::invalidate: Ending foreground activity / 'WebPageProxy::runJavaScriptInFrameInScriptWorld'     .... 

The Google-Mobile-Ads-SDK updated to latest version 8.12.0. If I disable GADAdLoader and GADBannerView, the repeating log will be disappeared.

Flutter App. One button that leads to the 2nd page where the content is.

  • The user clicks on the button and must watch a video ad(rewarded ad).

After the video ad finishes > the user can open the 2nd page / or the 2nd page will be automatically opened when he clicks 'x' on the finished video ad.

My question is > how to do this? What would the code look like and what to use? Thank you!

I had banner, interstitial, and reward ads on one of my apps. The ads seemed to have been working for the past 2 months and then suddenly yesterday both android and iOS apps stopped showing ads:

iOS Error: code: 1, domain: com.google.admob, message: Request Error: No ad to show

Android: code: 3, domain: com.google.android.gms.ads, message: No ad config

It's also strange that both the apps have different error codes.

Package: google_mobile_ads: ^0.12.1+1

Code:

Container(      height: bannerAd.size.height.toDouble(),      child: AdWidget(             ad: bannerAd,             ),      margin: EdgeInsets.symmetric(vertical: 30), ) 

Note:

  1. The test ads seem to work just fine.
  2. The Android and iOS apps have been published on the stores and have been working just fine for the past 2 months.

I'm working on converting my Kotlin App to Admob 20.1.0. Running into a problem integrating Rewarded Ads.

The problem is onUserEarnedReward is never called. I currently have no way of rewarding the user with the content they unlocked. My code below is placed in an onClickListener within an AppCompatActivity()

if (mRewardedAd != null) {     mRewardedAd?.show(this, OnUserEarnedRewardListener { // Redundant SAM-constructor         fun onUserEarnedReward(rewardItem: RewardItem) { // Function "onUserEarnedReward" is never used                          val rewardAmount = rewardItem.amount             val rewardType = rewardItem.type             println("======================= TYPE -  $rewardType /// AMOUNT - $rewardAmount")             // This never gets called.         }     }) } else {     println("=======================The rewarded ad wasn't ready yet.") } 

My imports:

import com.google.android.gms.ads.* import com.google.android.gms.ads.rewarded.RewardItem import com.google.android.gms.ads.rewarded.RewardedAd import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback import com.google.android.gms.ads.OnUserEarnedRewardListener 

Why am I getting Redundant SAM-constructor and Function "onUserEarnedReward" is never used ?