Hi all,
I saw the info that Google Mobile Ads is now offered through Google Play services, when I checked for an updated version of the AdMob SDK.
I read the setup guide (
https://developer.android.com/google/play-services/setup.html), the migration guide (
https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration) and the step by step guide (
https://developers.google.com/mobile-ads-sdk/docs/#play).
At the moment I’m using GoogleAdMobAdsSdk-6.4.1.jar and my apps support devices running Android 2.1 – 4.4. As Play Services are available for devices running 2.3 and higher only, the following questions arose, before I start to do the migration:
1. How do deliver ads to 2.1 & 2.2 devices, when I start using the Google Play Service to handle ads?
2. Is it possible to keep the GoogleAdMobAdsSdk-6.4.1.jar in the project to support 2.1 & 2.2 devices, while using the Play Services for everything >= 2.3?
Will something like this work:
private AdView adViewLegacy;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setup the app
.
// init ads
setUpAd();
}
public void setUpAd() {
// ad setup using 'Google Play Services'
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// new code using Play Services
.
}
// legacy ad code for Android 2.1 & 2.2
else {
adViewLegacy = new AdView(this, AdSize.SMART_BANNER, ADMOB_PUBLISHER_ID); // create the adView
((LinearLayout)findViewById(R.id.chartStatisticPeriods_adLayout)).addView(adViewLegacy); // add adView to Layout
AdRequest adRequest = new AdRequest(); // create ad request
adViewLegacy.loadAd(adRequest); // start loading the ad in the background.
}
}
3. On a 2.2 device, using the GoogleAdMobAdsSdk-6.4.1.jar and the legacy part of the code from above, I see the following log output: "03-27 21:12:38.108: E/ActivityThread(1202): Failed to find provider info for com.google.plus.platform"
Ads are displayed properly on the 2.2 device, but I don't see this log output on a 4.4 device, though.
Is this output related to the Google Play services not being supported on 2.2 (and 2.1) devices? Or does anyone know where this is coming from?
Thanks for your time,
Chris