繁体   English   中英

TapJoy 奖励视频广告未显示

[英]TapJoy Rewarded Videos ads not showing

我正在尝试在我的应用程序中实施 Tapjoy 奖励视频,但它们没有显示。

private var directPlayPlacement: TJPlacement? = null
private var TJlistener: TJPlacementListener? = null

这是我的 initTapJoy() 函数:

  fun initTapJoy() {
    val connectFlags: Hashtable<String, Any> = Hashtable<String, Any>()
    connectFlags[TapjoyConnectFlag.ENABLE_LOGGING] = "true";
    connectFlags[TapjoyConnectFlag.USER_ID] = AppPreferences.token;

    val callbackTJ = object : TJConnectListener {
        override fun onConnectSuccess() {
            this.tapJoyConnectSuccess()
            Timber.d(TAG, "TapJoy SDK connected");
        }

        override fun onConnectFailure() {
            Timber.d(TAG, "TapJoy SDK not connected");
        }

        fun tapJoyConnectSuccess() {
            Tapjoy.setActivity(activity);
            Tapjoy.setUserID(AppPreferences.token);

            directPlayPlacement = Tapjoy.getPlacement("RewardedVideo", TJlistener)

            TJlistener = object : TJPlacementListener  {
                override fun onRequestSuccess(p0: TJPlacement?) {
                    if (p0 != null) {
                        Timber.i("Tapjoy on request success, contentAvailable: %s", p0.isContentAvailable)
                    } else {
                        initTapJoy()
                    }
                }

                override fun onRequestFailure(p0: TJPlacement?, p1: TJError?) {
                    //activity.toast(getString(R.string.adds_content_empty))
                    Log.d(TAG,"onRequestFailure")
                }

                override fun onContentReady(p0: TJPlacement?) {}

                override fun onContentShow(p0: TJPlacement?) {}

                override fun onContentDismiss(p0: TJPlacement?) {
                    initTapJoy()
                }

                override fun onPurchaseRequest(p0: TJPlacement?, p1: TJActionRequest?, p2: String?) {}

                override fun onRewardRequest(p0: TJPlacement?, p1: TJActionRequest?, p2: String?, p3: Int) { }

                override fun onClick(p0: TJPlacement?) {
                    if (p0 != null) {
                        TapjoyLog.i(TAG, "onClick for direct play placement " + p0.getName())
                    }
                }

            }

            directPlayPlacement?.videoListener = object: TJPlacementVideoListener {
                override fun onVideoStart(p0: TJPlacement?) {}

                override fun onVideoError(p0: TJPlacement?, p1: String?) {
                    activity.toast(getString(R.string.adds_content_empty))
                }

                override fun onVideoComplete(p0: TJPlacement?) {
                    getReward(4)
                }

            }

            //load ad
            if (directPlayPlacement != null) {
                directPlayPlacement!!.requestContent();
            } else {
                Log.d(TAG, "Tapjoy SDK must finish connecting before requesting content.")
            }


        }
    }

    Tapjoy.connect(activity, API_KEY, connectFlags, callbackTJ);

    Tapjoy.setDebugEnabled(true);

}

这是 showTapjoyRewardedVideo() 函数:

private fun showTapJoyRewardedVideo() {
        if (directPlayPlacement == null) {
            Log.d(TAG, "Tapjoy: Direct Play placement is null. No direct play video to show")
        }
        if (directPlayPlacement?.isContentAvailable!!) {
            if (directPlayPlacement!!.isContentReady) {
                directPlayPlacement!!.showContent();
            } else {
                Log.d(TAG, "Tapjoy: Video not ready to show")
            }
        } else {
            Log.d(TAG, "Tapjoy: No video to show")
        }

    }

LogCat: http : //prntscr.com/udhl8e

请注意,我已将我的设备添加为测试设备,但它们仍未显示,另外我还要求来自不同国家/地区的人们打开奖励视频,因为我认为他们没有适用于我的国家/地区的视频,但我没有工作。

编辑:我忘了提到使用上面的代码,另一个名为 AppLaunch 的默认放置显示为模式,这意味着集成有效,但它不适用于奖励视频。

任何帮助将不胜感激!

解决方案是让我的货币得到 TapJoy 的批准,我的代码没有任何问题。

暂无
暂无

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

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