Posts tagged with admob

Although I have implemented com.google.android.gms.ads:20.0.0 in my project, still I am not able to use interstitialAd.setAdUnitId(), loadAd.
Here is what I have:

import androidx.multidex.BuildConfig; import com.google.android.gms.ads.Adlistener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.IntersitialAd; import com.google.android.gms.ads.intersitital.IntersisitalAd; 

Here is where I'm trying to use the method:

public void interstitalLoadAd(Context context){     mInterstitialAd = new InterstitialAd(context);     mInterstitialAd.setAdUnitId(BuildConfig.DEBUG ?         TEST_INTERSTITIAL_AD_UNIT_ID :         INTERSTITIAL_AD_UNIT_ID);     mInterstitialAd.loadAd(new AdRequest.Builder().build());     mInterstitialAd.setAdListener(this); } public void showAd(){     if (mInterstitialAd.isLoaded()){         mInterstitialAd.show();  } 

I recently integrated google_mobile_ads plugin for Flutter after firebase_admob plugin got deprecated. Ever since then my Rewarded Ads stopped working. These are the errors I get:

(13077): This request is sent from a test device. E/chromium(13077): [ERROR:cookie_manager.cc(137)] Strict Secure Cookie policy does not allow setting a secure cookie for http://googleads.g.doubleclick.net/ for apps targeting >= R. Please either use the 'https:' scheme for this URL or omit the 'Secure' directive in the cookie value. W/Ads (13077): #004 The webview is destroyed. Ignoring action.

My code is as below:

void main() {   WidgetsFlutterBinding.ensureInitialized();   MobileAds.instance.initialize();   InAppPurchaseConnection.enablePendingPurchases();   runApp(MyApp()); } class _RewardedVideoState extends State<RewardedVideo>{   bool _rewardedReady = false;   RewardedAd _rewardedAd;   static final AdRequest _adRequest = AdRequest(     keywords: <String>['Puzzles', 'Games', 'Word Games'],     nonPersonalizedAds: true,   );   @override   void didChangeDependencies() {     createRewardedAd();     super.didChangeDependencies();   }   void createRewardedAd([Score userScore]) {     print('Inside createRewardedAd');     // RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("CFA70A4A1BD59DA3323D586CA8BD2541"))     _rewardedAd = RewardedAd(       adUnitId: RewardedAd.testAdUnitId,       request: _adRequest,       listener: AdListener(           onAdLoaded: (Ad ad) {             print('${ad.runtimeType} loaded. RADHA ');             _rewardedReady = true;           },           onAdFailedToLoad: (Ad ad, LoadAdError error) {             print('${ad.runtimeType} failed to load: $error');             ad.dispose();             _rewardedAd = null;             createRewardedAd(userScore);           },           onAdOpened: (Ad ad) => print('${ad.runtimeType} onAdOpened.'),           onAdClosed: (Ad ad) {             print('${ad.runtimeType} closed.');             ad.dispose();             createRewardedAd(userScore);           },           onApplicationExit: (Ad ad) =>               print('${ad.runtimeType} onApplicationExit.'),           onRewardedAdUserEarnedReward: (RewardedAd ad, RewardItem reward) {             userScore.updateHintsEarned(reward.amount);           }),     )..load();     print('Completed RewardedAd Load ' + _rewardedAd.toString());   }   @override   void dispose() {     _rewardedAd.dispose();     super.dispose();   }   @override   Widget build(BuildContext context) {     final Score userScore = Provider.of<Score>(context, listen: false);     print('Inside RewardedVideo widget *** ........');     try {       if (_rewardedReady) {         print('Showing rewardedAd ***');         _rewardedAd.show();         _rewardedReady = false;         _rewardedAd = null;       } else         createRewardedAd(userScore);     } catch (e) {       print("error in showing ad: " + e.toString());     }     return SizedBox(       height: 0,     );   } } 

I am able to get banner ads (not included in this code) but rewarded ad does not load at all. Any idea what might be going wrong here?

The production instance of my android app has been crashing. The stack trace isn't much useful. The crash may be coming off of com.google.android.gms.common.GooglePlayServicesUtilLight.getRemoteContext but it may not be the ultimate culprit. Pasting the stack trace below:

Fatal Exception: java.lang.RuntimeException: android.os.DeadSystemException        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:746)        at android.app.LoadedApk.access$100(LoadedApk.java:99)        at android.app.LoadedApk$SplitDependencyLoaderImpl.constructSplit(LoadedApk.java:597)        at android.content.pm.split.SplitDependencyLoader.loadDependenciesForSplit(SplitDependencyLoader.java:70)        at android.app.LoadedApk$SplitDependencyLoaderImpl.ensureSplitLoaded(LoadedApk.java:632)        at android.app.LoadedApk$SplitDependencyLoaderImpl.getSplitPathsForSplit(LoadedApk.java:641)        at android.app.LoadedApk.getSplitPaths(LoadedApk.java:658)        at android.app.ContextImpl.createResources(ContextImpl.java:2152)        at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2214)        at android.app.ContextImpl.createPackageContext(ContextImpl.java:2193)        at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:884)        at com.google.android.gms.common.GooglePlayServicesUtilLight.getRemoteContext(GooglePlayServicesUtilLight.java:125)        at com.google.android.gms.internal.ads.zzabl.initialize(zzabl.java:23)        at com.google.android.gms.internal.ads.zzabp.zzi(zzabp.java:15)        at com.google.android.gms.internal.ads.zzabo.get(zzabo.java:11)        at com.google.android.gms.ads.internal.util.zzbr.zza(zzbr.java:13)        at com.google.android.gms.internal.ads.zzabp.initialize(zzabp.java:1)        at com.google.android.gms.internal.ads.zzamy.run(zzamy.java:2)        at java.lang.Thread.run(Thread.java:919) 

Please take a look and let me know if any more details are required to be shared. I am using the following dependencies for google ads API:

implementation 'com.google.android.gms:play-services-ads:19.7.0' implementation group: 'com.github.ankitbatra11', name: 'billboard', version: '2.0.1' implementation group: 'com.google.ads.mediation', name: 'facebook', version: '6.2.0.1' implementation group: 'com.google.ads.mediation', name: 'adcolony', version: '4.4.0.0' 

I have a mobile game, in which i have user engagement of 10 minutes and user retention day 1 of 27%, I'm doing app promotion on Google Ads, so in USA and United Kingdom my CPI in Google Ads is 0,15$, But i still have ROI = 0,4, is that not too small?

Can anyone help me on some suggestions on what makes that so small? Thanks in advance.