When dismiss interstitial DFP ad on Android, the app crashes

孤者浪人 提交于 2019-12-12 05:05:31

问题


I have a simple interstitial DFP (DoubleClick for Publishers) ad in my Android app. When I touch the cross to comeback to the app, the app closes itself.

The code is ok because it works in another app. Does anyone have an idea?

Here is the code in the manifest :

<activity 
        android:name="com.google.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize"/>

In the activity where I want the pub:

...extends Activity implements OnTouchListener, OnClickListener, OnErrorListener, AdListener, OnCompletionListener...

and the pub code:

private DfpInterstitialAd interstitial;
interstitial = new DfpInterstitialAd(this, "THE_PUB_CODE");
AdRequest adRequest = new AdRequest();
interstitial.loadAd(adRequest);
interstitial.setAdListener(this);

回答1:


I found the solution

There was a finish() in the method onUserLeaveHint()



来源:https://stackoverflow.com/questions/14709775/when-dismiss-interstitial-dfp-ad-on-android-the-app-crashes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!