gpt4 book ai didi

java - cocos2d-x/firebase/admob加载插页式广告失败

转载 作者:行者123 更新时间:2023-11-30 10:21:11 25 4
gpt4 key购买 nike

我正在遵循此官方指南将firebase / admob集成到我的cocos2d-x项目中。

https://firebase.google.com/docs/admob/cpp/quick-start

这是我的代码:

void Helper::initializeAdmob() {

// Initialize Firebase for Android.
firebase::App* app = firebase::App::Create(firebase::AppOptions(), JniHelper::getEnv(), JniHelper::getActivity());
// Initialize AdMob.
firebase::admob::Initialize(*app, admob_app_id);
firebase::admob::Initialize(*app);

interstitial_ad = new firebase::admob::InterstitialAd();
interstitial_ad->Initialize(static_cast<firebase::admob::AdParent>(getAdParent()), testing_boolean ? interstitial_id_for_testing : interstitial_id);

}

void Helper::requestInterstitialAd() {

if (interstitial_ad->InitializeLastResult().status() == firebase::kFutureStatusComplete && interstitial_ad->InitializeLastResult().error() == firebase::admob::kAdMobErrorNone) {
firebase::admob::AdRequest request = {};
const char* myKindleFireDeviceId = "7E9D27D370EA69CD2B962EE957B1C198";
static const char* testDevices[] = {myKindleFireDeviceId};
request.test_device_ids = testDevices;
request.test_device_id_count = sizeof(testDevices) / sizeof(testDevices[0]);
interstitial_ad->LoadAd(request);
}

}

void Helper::showInterstitialAd() {
if (interstitial_ad->LoadAdLastResult().status() == firebase::kFutureStatusComplete && interstitial_ad->LoadAdLastResult().error() == firebase::admob::kAdMobErrorNone) {
interstitial_ad->Show();
}
}


initializeAdmob()执行得很好。
然后对于 requestInterstitialAd(),我得到400错误:

12-23 22:57:28.743 24354-25845/com.xx.xx W/Ads: Received error HTTP response code: 400
12-23 22:57:28.756 24354-25845/com.xx.xx W/Ads: There was a problem getting an ad response. ErrorCode: 0
12-23 22:57:28.759 24354-24354/com.xx.xx W/Ads: Failed to load ad: 0


编辑:

我正在用火种。

编辑2:

我的点燃火已连接到互联网。

编辑3:

我正在使用自己的admob应用ID和android插页式广告的测试ID

编辑4:

我尝试了横幅广告并获得相同的结果。
我也试过模拟器和相同的结果。

最佳答案

您可以在Play商店尝试任何设备吗? Kindle Fire曾经为我工作,但在Admob停止提供独立的SDK之后就不再起作用了。

关于java - cocos2d-x/firebase/admob加载插页式广告失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47958727/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com