admob SettingEnabled false
admob SettingEnabled false
我有一个代码,我使用与我丢失代码的其他应用程序相同的 ID。我可以告诉你的是,这个 id 是有效的,但是当我丢失代码时,我无法告诉你这个应用程序代码是否有效。奇怪的是,它正在开发另一个使用 admob 和 facebook 中介的应用程序。那么为什么它不能使用这段代码,我在开发者 admob 网站上做了同样的事情
这是我的代码
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-2945227826409900/1799805283");
adView = findViewById(R.id.adView111);
AdRequest adRequest = new AdRequest.Builder().build();
adView.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
System.out.print("onAdLoadedAdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
System.out.print("onAdFailedToLoad");
System.out.print( errorCode );
}
});
当我按下按钮加载广告时:
Bundle extras = new FacebookExtras()
.setNativeBanner(true)
.build();
AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(FacebookAdapter.class, extras)
.build();
finalAdView.loadAd(request);
xml代码:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView111"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-2945227826409900/1799805283">
</com.google.android.gms.ads.AdView>
android 清单:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2945227826409900~3138961208"/>
如果您需要使用它们,我会提供 ID。感谢您的帮助。
一个可以帮助你的细节
当我执行代码时
adView.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
System.out.print("onAdLoadedAdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
System.out.print("onAdFailedToLoad");
System.out.print( errorCode );
}
});
它打印出这个错误
I/qtaguid: Tagging socket 116 with tag f00d00000000{61453,0} for uid -1, pid: 3713, getuid(): 10198
bookAdapter: No fill
I/Ads: Ad failed to load : 3
I/System.out: onAdFailedToLoad3(HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("4547CA1BE4A487BC5C31C744260B4378") to get test ads on
即使有人坐下来他们说广告加载失败 3 是正常的并且代码正常工作但是这次它在之前的应用程序上工作所以为什么?
加载广告失败:3此错误有多种原因
- 忘记在 Google AdMod
上添加付款方式
- 如果应用处于调试模式而不是发布模式
- 您的代码是正确的,但由于对服务器的请求量较少
您的广告不可见
- 忘记在 google consol
中启用包含广告
在我的情况下,我忘记在 google 控制台中启用 "Contain Ads"。你也签入 google 控制台
在 Google 开发者控制台中有一个名为 "Pricing and Distribution" 的部分。在此部分中有一个复选框 "CONTAINS ADS"。在我们的例子中它被禁用了。启用后我们成功收到广告。
我有一个代码,我使用与我丢失代码的其他应用程序相同的 ID。我可以告诉你的是,这个 id 是有效的,但是当我丢失代码时,我无法告诉你这个应用程序代码是否有效。奇怪的是,它正在开发另一个使用 admob 和 facebook 中介的应用程序。那么为什么它不能使用这段代码,我在开发者 admob 网站上做了同样的事情
这是我的代码
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-2945227826409900/1799805283");
adView = findViewById(R.id.adView111);
AdRequest adRequest = new AdRequest.Builder().build();
adView.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
System.out.print("onAdLoadedAdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
System.out.print("onAdFailedToLoad");
System.out.print( errorCode );
}
});
当我按下按钮加载广告时:
Bundle extras = new FacebookExtras()
.setNativeBanner(true)
.build();
AdRequest request = new AdRequest.Builder()
.addNetworkExtrasBundle(FacebookAdapter.class, extras)
.build();
finalAdView.loadAd(request);
xml代码:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView111"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-2945227826409900/1799805283">
</com.google.android.gms.ads.AdView>
android 清单:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2945227826409900~3138961208"/>
如果您需要使用它们,我会提供 ID。感谢您的帮助。 一个可以帮助你的细节 当我执行代码时
adView.setAdListener(new com.google.android.gms.ads.AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
System.out.print("onAdLoadedAdLoaded");
}
@Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
System.out.print("onAdFailedToLoad");
System.out.print( errorCode );
}
});
它打印出这个错误
I/qtaguid: Tagging socket 116 with tag f00d00000000{61453,0} for uid -1, pid: 3713, getuid(): 10198
bookAdapter: No fill
I/Ads: Ad failed to load : 3
I/System.out: onAdFailedToLoad3(HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/Ads: Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("4547CA1BE4A487BC5C31C744260B4378") to get test ads on
即使有人坐下来他们说广告加载失败 3 是正常的并且代码正常工作但是这次它在之前的应用程序上工作所以为什么?
加载广告失败:3此错误有多种原因
- 忘记在 Google AdMod 上添加付款方式
- 如果应用处于调试模式而不是发布模式
- 您的代码是正确的,但由于对服务器的请求量较少 您的广告不可见
- 忘记在 google consol 中启用包含广告
在我的情况下,我忘记在 google 控制台中启用 "Contain Ads"。你也签入 google 控制台
在 Google 开发者控制台中有一个名为 "Pricing and Distribution" 的部分。在此部分中有一个复选框 "CONTAINS ADS"。在我们的例子中它被禁用了。启用后我们成功收到广告。