12

我刚刚意识到 Google 将 AdMob 嵌入到最新的 Google Play 服务中 (4+)

我想知道,我应该更喜欢https://developers.google.com/mobile-ads-sdk/docs/#play而不是https://developers.google.com/mobile-ads-sdk/docs/#android吗?因为我看不到谷歌官方对此的立场。

我之所以这么问,是因为我发现Google Play 服务中的 AdMob 仍然存在很多问题。

这是我的观察。

  1. 从 Java 代码创建一个智能横幅,并将其放置在滚动视图的中间。
  2. 每当智能横幅成功从 Google 服务器获取广告时,滚动视图将自动滚动以使智能横幅可见。

从我的角度来看,这似乎是一种不受欢迎的行为。这就是为什么,我仍然犹豫是否要迁移到新的 Google Play 服务。

可在此处找到演示该错误的完整源代码:来自 Google Play 服务的 AdMob 将执行不希望的自动滚动

4

3 回答 3

4

如果您想集成许多广告 SDK,并且如果他们使用 Google Play 服务作为后端支持来投放广告,并且您还想展示 Admob 横幅广告,那么您应该使用它。

它非常易于使用。只需添加 goole play service lib 项目,然后使用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:ads="http://schemas.android.com/apk/res-auto"

              android:id="@+id/linearLayout"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <com.google.android.gms.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId="a1529793ead3391"
                         ads:adSize="BANNER"/>

</LinearLayout>

现在您可以在要显示的活动中简单地添加以下代码段

 AdView adView = (AdView)findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
于 2014-01-22T11:29:44.017 回答
0

当然是。
这篇文章中,独立的 Android Google AdMob SDK(“旧”版本)已被宣布弃用。Google 警告说, Play 商店将于2014 年 8 月 1 日停止接受使用独立 Google AdMob SDK 的新应用或更新应用。

于 2014-05-12T21:08:29.953 回答
-1

是的。绝对可以从 Google Play Services 库切换到 Admob 类。这是 Admob 的新分发方式,将确保他们可以更轻松地更新它的实现,因为他们可以更新手机上的 GPS 实现,而无需您推出新版本的应用程序。

请注意,在 GPS 库中有 2 个版本的 Admob 类。当前包com.google.ads.*中的和新包中的com.google.android.gms.ads.*。使用新包装中的那些。

如果您以编程方式创建 AdRequest,那么您现在需要使用 Builder。

AdRequest adRequest = new AdRequest.Builder().build();

如果您在布局 XML 中定义 AdView,请确保您也在那里更新包。即<com.google.android.gms.ads.AdView代替<com.google.ads.AdView.

于 2013-11-13T21:42:00.930 回答