【发布时间】:2016-09-13 06:03:52
【问题描述】:
我刚收到来自 Google 的电子邮件,说他们将在 10 月 17 日起停止展示广告,因为这些方法已被弃用。我还在以下一些链接上研究了它:-
https://firebase.google.com/docs/admob/android/quick-start
https://github.com/googleads/googleads-mobile-android-examples
以上是 GitHub 链接,Google 提供的带有新 SDK 的示例,用于 android -studio,因为我的应用程序在过去 2 年已经上市。那么我需要将整个项目迁移到 Android Studio 吗?或者有什么方法可以在 eclipse 中进行更新?
我还发现了一个链接,其中指出如果我们使用版本高于 4 的 Google Play 服务,那么我们的广告将不会受到 Google 的影响
这是链接:- Upgrade your Android Google Mobile Ads SDK to ensure ads keep serving
这是我的 Google Play 服务版本详细信息:-
android:versionCode="5089000"
android:versionName="5.0.89-000"
我用来获取广告的方法:-
private void getAds() {
try {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("").build();
adView.loadAd(adRequest);
adView.setBackgroundColor(Color.BLACK);
} catch (Exception e) {
e.printStackTrace();
}
}
在我的 XML 中:-
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
ads:adSize="BANNER"
ads:adUnitId="YOUR KEy"
android:background="@drawable/container_ads_bg" />
请也看看这个链接 :-
https://firebase.google.com/docs/admob/android/existing-app
这说明在eclipse中也可以做到。
问题是我的代码已经快 3 年了所以我有点害怕迁移它,但是如果我没有其他选择,那么我肯定会迁移它。
那么我是否需要更新 SDK 并使用 FireBase 对其进行配置?
请告诉我,因为我们更新 SDK 的时间已经不多了。
谢谢。
【问题讨论】:
-
迁移到 Android Studio 非常简单。 Android Studio 提供从 Eclipse 导入项目的功能。尝试使用 Android Studio,你会爱上它,再也不会回到 Eclipse。
-
最好更新到最新的 Android Studio 和 firebase 版本,以便您的移动应用程序拥有最新的库等。但是要回答您的问题是否必须更新?- 不,您不需要更新 SDK 甚至使用 Firebase 进行配置。您现有的应用程序将继续运行而不会出现任何问题。