googleads / googleads-mobile-android-mediation

Sample Android project showcasing how to build a mediation adapter or custom event for the Google Mobile Ads SDK.
Apache License 2.0
242 stars 198 forks source link

ClassCastException: com.google.ads.mediation.chartboost.ChartboostAdapter cannot be cast to com.google.android.gms.ads.mediation.OnContextChangedListener #95

Open ber4444 opened 6 years ago

ber4444 commented 6 years ago

I believe ChartboostAdapter should implement OnContextChangedListener with an empty implementation of onContextChanged(Context c), otherwise code like this will throw the above exception:

    @Override
    public void onResume() {
        super.onResume();
        Chartboost.onResume(this);
        if (rewardedVideoAd!=null) rewardedVideoAd.resume(MainActivity.this);
    }

Note that is code is a mix of what there is already in your sample (rewardedVideoAd.resume), and what https://developers.google.com/admob/android/mediation/chartboost recommends doing (Chartboost.onResume).

ericleich commented 5 years ago

Please confirm: this exception is just logged as a warning. The app doesn't crash because of this, correct?