不记录广告曝光。没有活跃的活动。'Google Admob RewardedVideo'

Emr*_*mir 5 android android-activity firebase google-admob

当我想切换到另一个活动时出现错误。问题现在就开始了:我试图添加“Google Admob RewardedVideo”。添加flag广告后就没有问题了。

23198-23236/com.metabrain.emre V/FA:记录用户参与度,毫秒:46984

23198-23236/com.metabrain.emre V/FA:活动暂停,时间:84767609

23198-23236/com.metabrain.emre V/FA:不记录广告单元曝光。没有活动

23198-23236/com.metabrain.emre V/FA:不记录广告曝光。没有活动

信息:

21105-21105/? W/IInputConnectionWrapper:在非活动输入连接上显示状态图标

18621-18621/? I/FA:应用测量正在启动,版本:10084

18621-18621/? I/FA:启用调试日志运行: adb shell setprop log.tag.FA VERBOSE

18621-18621/? I/FA:要启用更快的调试模式事件日志记录,请运行:adb shell setprop debug.firebase.analytics.app com.ext.ui

18276-18484/? I/FA-SVC:应用测量正在启动,版本:11302

18276-18674/? I/FA-SVC:此实例被标记为上传者

19034-19034/com.metabrain.emre I/FA:应用测量正在启动,版本:11020

19034-19034/com.metabrain.emre I/FA:启用调试日志运行:adb shell setprop log.tag.FA VERBOSE

19034-19034/com.metabrain.emre I/FA:启用更快的调试模式事件日志记录运行:adb shell setprop debug.firebase.analytics.app com.metabrain.emre

19034-19069/com.metabrain.emre I/FA:未找到标签管理器,因此不会使用

详细:

085 19034-19069/com.metabrain.emre V/FA:使用测量服务 08-13 15:05:15.085 19034-19069/com.metabrain.emre V/FA:连接尝试已在进行中 08-13 15:05: 15.087 19034-19069/com.metabrain.emre D/FA: 记录事件 (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=Main_Activity, firebase_screen_id(_si)=-94930} ] 08-13 15:05:15.101 19034-19069/com.metabrain.emre V/FA:使用测量服务 08-13 15:05:15.101 19034-19069/com.metabrain.emre V/FA:连接尝试已经在进度 08-13 15:05:15.105 19034-19069/com.metabrain.emre V/FA:活动恢复,时间:83370181 08-13 15:05:15.270 19034-19069/com.暴露时间小于 1000 毫秒。事件未发送。时间:184 08-13 15:05:15.270 19034-19069/com.metabrain.emre V/FA:

依赖项:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        compile 'com.google.firebase:firebase-core:11.0.4'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.google.firebase:firebase-ads:11.0.4'
    compile 'com.google.firebase:firebase-crash:11.0.4'
    ...
    testCompile 'junit:junit:4.12'
    compile "com.google.android.gms:play-services-games:11.0.4"
    compile 'com.android.support:multidex:1.0.1'
    compile project(path: ':BaseGameUtils')
}
Run Code Online (Sandbox Code Playgroud)

小智 0

我曾经遇到过这样的插页式广告问题,发现用户试图离开活动,而插页式广告已加载但尚未向用户显示。我通过以下方式解决了这个问题:

  1. 定义一个布尔标志:

    私有布尔addIsReady;
  2. 加载广告时,在 adListener 类中设置标志状态:

    myAd.setAdListener(new AdListener() {
             @Override
             public void onAdLoaded() {
                 addIsReady = true;
             }
    
             @Override
             public void onAdFailedToLoad(int errorCode) {
                 addIsReady = false;
             }
     }
    Run Code Online (Sandbox Code Playgroud)
  3. 在向用户展示广告之前,在如下方法中将标志设置为 false:

    无效showInterstitialAd(){
      if (mmAd == null) 返回;
         如果(myAd.isLoaded()){
             addIsReady = false;
             myAd.show();
         }
     }
  4. 检查在用户离开活动之前是否已加载,如果是,则向用户显示已加载的广告(此步骤解决了我的问题)

    @Override
    public void onBackPressed() {
        if (addIsReady){
            requiredLawIndex = -1;
            showInterstitialAd();
        }
        super.onBackPressed();
    }
    
    Run Code Online (Sandbox Code Playgroud)

我希望这个答案可以帮助你。