13

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.

2 Answers 2

15

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.

13
  • 2
    Thanks. I guess I'll just have to take your word for it since I'm unable to totally remove Google Play Services from my device to check case 4. Shame Google/Android don't say this more explicitly somewhere because it's a lot of work to get the check working (which I have now thankfully!).
    – snark
    Commented Feb 4, 2014 at 11:32
  • 2
    You could try case 4 on an emulator without Google APIs. Or if you have a Kindle Fire lying around. Android won't say this more explicitly because in general Play Service APIs simply don't work if the service isn't available. But AdMob could probably do a better job of mentioning it. Commented Feb 5, 2014 at 1:28
  • 1
    I believe that also the analytics part from Google Play Services library can be used without the services apk. It would be great if anyone can confirm this on an Amazon device. Commented May 8, 2014 at 12:58
  • 1
    It is already there on the downloads page. It could also be added as an FAQ to the new quick start guide. Commented Oct 9, 2014 at 0:47
  • 2
    @snark BTW i just found out amazon is providing an awesome service. You can just drag your apk to amazon for testing and they will also show screens of how your app will look and feel on their devices. Here is the link developer.amazon.com/public/resources/development-tools/… Commented Jan 11, 2015 at 9:29
1

The logcat error you are getting is for either case 2 or 3.

Whether Admob craps out on case 4 is interesting. I suspect it will be ok because the old Admob classes ship with the GPS library so in worse case it could fall back to using their pathway.

Not the answer you're looking for? Browse other questions tagged or ask your own question.