你真的需要检查谷歌Play业务使用AdMob的? [英] Do you really need to check for Google Play services to use AdMob?

查看:632
本文介绍了你真的需要检查谷歌Play业务使用AdMob的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌的说明这里说,如果你想使用AdMob的在你的Andr​​oid应用通过谷歌Play业务,你必须确保用户的设备安装了谷歌播放服务APK。不过,我有极大的麻烦试图得到这个工作;而且我发现,即使我卸载谷歌播放服务更新我的手机(也懒得检查,如果是可用的服务),我的应用程序仍然是完全能够检索和显示广告!尽管这是在LogCat中的错误如下所示:

  W / GooglePlayServicesUtil(26558):谷歌Play业务已经过时了。需要4132500但发现3159130
 

presumably我的手机仍然有安装,当它来到了工厂谷歌Play业务的原始版本。我只是想知道我真正的需要是否检查谷歌Play业务是提供给成功使用AdMob的。现在看来并非如此。请谁能告诉我为什么我要费心思做此项检查。它是处理案件4日,谷歌的链接我给上面的...?

  

在谷歌播放或服务APK丢失禁用设备上,而如果用户明确卸载或禁用可能会发生。

解决方案

TL; DR - 你不需要检查谷歌Play业务使用移动广告的API

在谷歌移动广告产品在谷歌Play业务是唯一,它的可以的工作大部分在谷歌的其他库(所有?)播放服务,而服务安装在设备上的APK

如果在设备上安装的APK是最新版本,该库将加载的类的APK服务,并使用这些新类来请求广告。否则,谷歌播放服务,你在你的应用程序编译版本足以获取广告。

这里的好处是,你有效地将始终对库的最新版本上运行时,该设备已安装的服务。而在您的服务版本比你编译的(例如:你上面的例子),您的应用程序版本的情况下,或在有设备上没有服务的情况下(例如:Kindle Fire的),你的应用程序编译库还可以做的广告抓取,但你还是要拉手动更新

Google's instructions here say that if you want to use AdMob in your Android app via Google Play services you must ensure the user's device has the Google Play services APK installed. However, I'm having terrible trouble trying to get this working; and I've noticed that even if I uninstall the Google Play services updates on my phone (and don't bother checking if the services is available) my app is still perfectly able to retrieve and display ads! This is despite errors in LogCat like the following:

W/GooglePlayServicesUtil(26558): Google Play services out of date.  Requires 4132500 but found 3159130

Presumably my phone still has the original version of Google Play services installed when it came out the factory. I'm just wondering whether I really need to check for Google Play services being available to use AdMob successfully. Right now it appears not. Please can someone tell me why I should bother having to make this check. Is it to handle case 4 at that Google link I gave above...?

The Google Play services APK is missing or disabled on the device, which might happen if the user explicitly uninstalls or disables it.

解决方案

TL;DR - You do NOT need to check for Google Play services to use the Mobile Ads APIs.

The Google Mobile Ads offering in Google Play services is unique from most (all?) of the other libraries in Google Play services in that it CAN work without the service APK installed on the device.

If the APK installed on the device is a more recent version, the library will load the classes from the APK service and use these newer classes to request ads. Otherwise, the version of Google Play services that you compile in your app is sufficient to fetch ads.

The benefit here is that you effectively will always run against the latest version of the library when the device has the service installed. And in the case that your service version is older than the version you compiled your app against (ex: your example above) or in the case where there is no service on the device (ex: Kindle Fire), the library compiled with your app can still do the ad fetching, but you'll still have to pull in updates manually.

这篇关于你真的需要检查谷歌Play业务使用AdMob的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆