Admob interstitial ad still open when user comes back from clicking it

纵然是瞬间 提交于 2021-02-10 12:01:28

问题


When a user clicks an interstitial ad, the browser will open or whatever. When he navigates back to my app, the interstitial ad is still open and he has to close it.

How can I prevent an interstitial ad from still being displayed after the user clicked it and navigates back to my app?


回答1:


Add the following to your AndroidManifest.xml:

<activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:noHistory="true"/>

What noHistory does:

Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it's no longer visible on screen — "true" if it should be finished, and "false" if not. The default value is "false".

A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it. In this case, onActivityResult() is never called if you start another activity for a result from this activity.

Source: https://developer.android.com/guide/topics/manifest/activity-element.html#nohist



来源:https://stackoverflow.com/questions/46636235/admob-interstitial-ad-still-open-when-user-comes-back-from-clicking-it

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