我正在我的 android 应用程序中实施 Vungle 广告,
问题是当用户在按下概览按钮(默认按钮右侧)后向上滑动应用程序关闭应用程序时,同时 Vungle 奖励广告正在运行,
在奖励广告运行时关闭应用程序后,Vungle 广告行为很奇怪,
当用户再次打开应用程序时,它永远不会显示新广告,即使广告可用(canPlayAd 返回 true)但无法播放广告,或者有时奖励回调运行,甚至应用程序被用户关闭。
我只想在应用程序的主要活动 onDestroy 调用时销毁/关闭 Vungle 奖励广告。谢谢
if (Vungle.canPlayAd(placementId)) {
editActivityUtils.logGeneralEvent(context, "rewardedVdoPlayed", "$cat_name: $name")
firebaseAnalytics.setUserProperty("rewardedVdoPlayed", "$cat_name")
Vungle.playAd(placementId, adConfig, object : PlayAdCallback {
override fun onAdStart(id: String) {}
override fun onAdEnd(id: String, completed: Boolean, isCTAClicked: Boolean) {
Log.e("app", "Vungle ad end")
if ((!(context as TemplatesMainActivity).isDestroyed) && completed) {
Vungle.loadAd(placementId, object : LoadAdCallback {
override fun onAdLoad(id: String?) {
}
override fun onError(id: String?, exception: VungleException?) {
}
})
Log.e("app", "Vungle ad rewarded")
editActivityUtils.logGeneralEvent(context, "gotTemplateByRewardedVdo", "$cat_name: $name")
firebaseAnalytics.setUserProperty("gotTemplateByRewardedVdo", "$cat_name")
goToEditorWithoutAD(cat_name, name)
}
}
override fun onAdEnd(id: String) {}
override fun onAdClick(id: String) {}
override fun onAdRewarded(id: String) {
Log.e("app", "Vungle ad rewarded")
}
override fun onAdLeftApplication(id: String) {
Log.e("app", "Vungle left app")
}
override fun onError(id: String, exception: VungleException) {
Log.e("app", "Vungle ${exception.localizedMessage}")
}
})
}