我最近决定在我的Android应用程序上放置广告。我看到的问题是,当我第一次打开应用时,我只会收到“一个”广告。在那之后,我永远不会在其他任何地方看到广告。它只是空白!
据admob说,我得到100%的填充率,这没有任何意义。
这是我的logcat输出。
02-25 10:53:24.528: E/GooglePlayServicesUtil(8346): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
02-25 10:53:24.548: E/GooglePlayServicesUtil(8346): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
02-25 10:53:24.548: E/GooglePlayServicesUtil(8346): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
02-25 10:53:24.608: D/dalvikvm(1004): GC_CONCURRENT freed 393K, 18% free 18014K/21928K, paused 2ms+1ms, total 18ms
02-25 10:53:25.278: I/Ads(8346): Scheduling ad refresh 60000 milliseconds from now.
02-25 10:53:25.278: I/Ads(8346): Ad finished loading.
02-25 10:53:25.298: I/chromium(8346): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
02-25 10:53:25.318: I/chromium(8346): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
02-25 10:53:35.268: E/qcom_sensors_hal(767): hal_process_report_ind: Bad item quality: 11
02-25 10:53:48.698: I/Ads(8346): Ad is not visible. Not refreshing ad.
02-25 10:53:48.698: I/Ads(8346): Scheduling ad refresh 60000 milliseconds from now.
我不确定发生了什么。
这是我的xml布局。
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_below="@+id/video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="stuff"
ads:adSize="BANNER"
android:layout_centerHorizontal="true"/>
这是我的代码
AdView adView = (AdView)findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
注意:我在oncreate中为活动使用该代码,在onactivitycreated()中使用该代码。我对我应用中的所有广告使用了相同的adunitID。
Admob表示,它已经以100%的填充率提供了超过1万次展示。
答案 0 :(得分:1)
日志似乎表明AdView不可见:
02-25 10:53:48.698: I/Ads(8346): Ad is not visible. Not refreshing ad.
您尚未发布足够的布局或代码来解决原因。
答案 1 :(得分:0)
尝试以编程方式添加unitId和adSize,而不是像this谷歌代码示例那样从XML中添加。