我为我的应用添加 admob 作为指南:
https://firebase.google.com/docs/admob/android/quick-start
和
但是admob只是查看: 不错的工作!您正在展示来自 admob 的 320x50 测试广告
它不会改变其他广告。请帮助我。
代码如下:
在 onCreate 的 Activity 中:
MobileAds.initialize(this, "ca-app-pub-9518053516260440/6844465750");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
在 xml 中:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
最佳答案
根据快速入门
If you haven't created an AdMob account and registered an app yet, there's no better time than now. If you're just experimenting with the SDK in a Hello World app, though, you can use this App ID to call the initialize method: ca-app-pub-3940256099942544~3347511713.
您正在使用测试 appID。要使其正常工作,您需要创建自己的帐户。比创建应用程序并使用您自己的应用程序 ID。这将让您自定义应该显示的广告,它会显示实际的广告。但为了测试,您应该使用此 AppID,因为您不应点击自己的广告。
在 xml 中修复您的 appID。但即便如此,实际开始工作也需要一些时间。可能需要大约一天的时间才能开始显示真实广告。
关于android - 带有 firebase 的 Admob,仅查看广告 : Nice job! 您正在展示来自 admob 的 320x50 测试广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45933932/