简体   繁体   English

如何以编程方式关闭/完成我的 Vungle rewrded 视频广告,就像用户关闭应用程序或放入后台一样?

[英]How to close/finish my Vungle rewrded video ad programatically, as if user closes the app or put in background?

I am implementing the Vungle ads in my android app,我正在我的 android 应用程序中实施 Vungle 广告,

the problem is when the user closes the app by swiping up the app after pressing the overview button (the right one from default buttons), meanwhile, Vungle rewarded ad was running,问题是当用户在按下概览按钮(默认按钮右侧)后向上滑动应用程序关闭应用程序时,同时 Vungle 奖励广告正在运行,

After closing the application while the rewarded ad is running Vungle ad behavior is weird,在奖励广告运行时关闭应用程序后,Vungle 广告行为很奇怪,

when the user open the app again it never shows the new ad, even ad is available (canPlayAd returns true) but ad could not be played, or sometimes rewarded call back runs, even app is closed by the user.当用户再次打开应用程序时,它永远不会显示新广告,即使广告可用(canPlayAd 返回 true)但无法播放广告,或者有时奖励回调运行,甚至应用程序被用户关闭。

I just want to destroy/close the Vungle rewarded ad, when the application's main activity's onDestroy called.我只想在应用程序的主要活动 onDestroy 调用时销毁/关闭 Vungle 奖励广告。 Thanks谢谢

        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}")

            }
        })
    }

Sorry, your questions do not include enough information for me to give you an answer.抱歉,您的问题没有包含足够的信息,我无法回答您。 Please submit a ticket to Vungle tech-support@vungle.com for help.请向 Vungle tech-support@vungle.com提交工单以寻求帮助。

Below are some questions for the issue, please include the information and send to Vungle.以下是有关该问题的一些问题,请包含信息并发送给 Vungle。 The information should help Vungle to know what exactly happened on your side.这些信息应该有助于 Vungle 了解您身边到底发生了什么。

I am implementing the Vungle ads, the problem is when the user destroys the application while Vungle rewarded ad was running, after that Vungle ad behavior is weird,我正在实施 Vungle 广告,问题是当用户在 Vungle 奖励广告运行时销毁应用程序,之后 Vungle 广告行为很奇怪,

it never shows the new ad, even ad is available,它从不显示新广告,即使有广告,

-- In this case, yes, it looks weird. ——在这种情况下,是的,它看起来很奇怪。 Have you checked the ad available before calling the play function?在调用播放 function 之前,您是否检查过可用的广告?

or sometimes rewarded call back runs, even app is closed by the user.或者有时奖励回调运行,甚至应用程序被用户关闭。

-- Not sure which callback did you exactly mean. -- 不知道你到底指的是哪个回调。 Please show the code if possible.如果可能,请显示代码。

I just want to destroy Vungle rewarded ad, when activity's onDestroy called.我只想在活动的 onDestroy 调用时销毁 Vungle 奖励广告。

-- There should be nothing you need to do to destroy Vungle rewarded ads. -- 您无需执行任何操作即可销毁 Vungle 奖励广告。 Vungle should be able to help you figure out the weird behavior. Vungle 应该能够帮助您找出奇怪的行为。

Please provide also provide information to Vungle if you have:如果您有以下情况,请同时向 Vungle 提供信息:

Platform(s)(iOS, Android, Windows):平台(iOS、Android、Windows):

Device and operating system version:设备和操作系统版本:

Vungle APP ID(s): Vungle 应用程序 ID:

APP Name(s):应用程序名称:

Application Status, ie Testmode /Active / Inactive:应用状态,即Testmode /Active / Inactive:

Vungle SDK Version(s): Vungle SDK 版本:

Which type of Vungle SDK integration?哪种类型的 Vungle SDK 集成? (iOS, Android, Windows, or Plugin): (iOS、Android、Windows 或插件):

If using “Mediation” service, which one:如果使用“调解”服务,哪一项:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM