如果在使用facebook间隙广告时,其他方法不能正常工作,间隙广告将自动显示

ne5o7dgx  于 2021-07-11  发布在  Java
关注(0)|答案(1)|浏览(421)

if-else 用于检查is interstitial ad 是否加载。如果未加载,则 startIntentelse . (代码如下)。
问题(请参阅logcat):如果未加载ad,则 second activity 打开via else 几秒钟后再分开 AdListener 快跑那是在 if 零件 Interstitial ad 自动弹出[这是违反广告政策的]

2020-11-22 01:26:46.761 12278-12278/com.udai.aadharloan.kredit.finance.pmscheme E/HomeActivity: ===== BTN 1 ELSE PART
2020-11-22 01:26:48.631 12278-12278/com.udai.aadharloan.kredit.finance.pmscheme E/HomeActivity: ===== AdListener : Ad loaded and then show.
2020-11-22 01:26:48.731 12278-12470/com.udai.aadharloan.kredit.finance.pmscheme E/libc: Access denied finding property "vendor.debug.trace.perf"
2020-11-22 01:26:48.844 12278-12278/com.udai.aadharloan.kredit.finance.pmscheme E/HomeActivity: ===== loggin impression
2020-11-22 01:26:58.141 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/BufferQueueProducer: [unnamed-12278-7] setMaxDequeuedBufferCount: 2 dequeued buffers would exceed the maxBufferCount (2) (maxAcquired 1 async 0 mDequeuedBufferCannotBlock 0)
2020-11-22 01:26:58.141 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/Surface: IGraphicBufferProducer::setBufferCount(3) returned Invalid argument
2020-11-22 01:26:58.146 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/BufferQueueProducer: [unnamed-12278-8] setMaxDequeuedBufferCount: 2 dequeued buffers would exceed the maxBufferCount (2) (maxAcquired 1 async 0 mDequeuedBufferCannotBlock 0)
2020-11-22 01:26:58.146 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/Surface: IGraphicBufferProducer::setBufferCount(3) returned Invalid argument
2020-11-22 01:26:58.151 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/BufferQueueProducer: [unnamed-12278-9] setMaxDequeuedBufferCount: 2 dequeued buffers would exceed the maxBufferCount (2) (maxAcquired 1 async 0 mDequeuedBufferCannotBlock 0)
2020-11-22 01:26:58.151 12278-12314/com.udai.aadharloan.kredit.finance.pmscheme E/Surface: IGraphicBufferProducer::setBufferCount(3) returned Invalid argument
2020-11-22 01:27:50.611 12278-12278/com.udai.aadharloan.kredit.finance.pmscheme E/HomeActivity: ===== Ad dismissed.

在这里 else 部分运行,然后打开新活动。然后自动运行 AdListener 那在哪 If 部分(like:onadloaded,onloggingimpression,oninterstitualDisclosed)

@Override
    public void onClick(View v) {
        switch (v.getId()) {

            case R.id.btn1Home:
                if (interstitialAd.isAdLoaded()) {
                    Log.e(TAG, "===== btn 1: if part running");
                    interstitialAd=new InterstitialAd(this,"166868475011030_166000348414076");
                    interstitialAdListener=new InterstitialAdListener(){
                        @Override public void onInterstitialDisplayed(Ad ad){}
                        @Override public void onInterstitialDismissed(Ad ad){
                            Log.e(TAG, "===== Ad dismissed.");
                            Intent intent1btn=new Intent(HomeActivity.this,page1activity.class);
                            startActivity(intent1btn);}
                        @Override public void onError(Ad ad,AdError adError){}
                        @Override public void onAdLoaded(Ad ad){
                            Log.e(TAG, "===== AdListener : Ad loaded and then show.");
                            interstitialAd.show();}
                        @Override public void onAdClicked(Ad ad){}
                        @Override public void onLoggingImpression(Ad ad){Log.e(TAG, "===== loggin impression");}};
                    // For auto play video ads, it's recommended to load the ad
                    // at least 30 seconds before it is shown
                    interstitialAd.loadAd(interstitialAd.buildLoadAdConfig().withAdListener(interstitialAdListener).build());

                }else {
                        Log.e(TAG, "===== BTN 1 ELSE PART");
                        if (!interstitialAd.isAdLoaded()) {
                            interstitialAd.loadAd();
                            Intent intent1btn = new Intent(HomeActivity.this, page1activity.class);
                            startActivity(intent1btn);
                        }
                }

                break;
.........

我怎样才能解决这个facebook插播广告的问题?

5n0oy7gb

5n0oy7gb1#

我解决这个问题:
不要打电话 interstitialAd.show()onAdLoaded(Ad ad) .
刚刚打过去 AdListener 之前的平均值 Log.e(TAG, "===== btn 1: if part running")

相关问题