MediationAdRequest from GPS mobile ads API no longer has .getLocation() method

47 views
Skip to first unread message

Tony Chan

unread,
Jul 31, 2014, 9:09:22 PM7/31/14
to google-adm...@googlegroups.com
I'm updating my CustomEventBanner classes to the new Google Play Services mobile ads API. I use AdMob for ad mediation and not all of the third party ad networks I use are officially supported, so I made CustomEvent classes (both banner and interstitial) for them to use as adapters.

In the requestBannerAd()/requestInterstitialAd() methods I get passed a MediationAdRequest object where I normally grab the location (which was set when I first made the ad load request) with the getLocation() method, but in the new GPS mobile ads API they removed that method from the MediationAdRequest class.

What is the alternative now for grabbing a Location? It seems really counterproductive if I no longer have access to the Location that I took time to fetch early on. Do I really have to grab a whole new Location from the system's LocationManager again?

Here is some sample code to illustrate the issue taken from my CustomEventBanner class I made for the Greystripe ad network:

    @Override
    public void requestBannerAd(Context context, CustomEventBannerListener listener,
            String serverParameter, AdSize size, MediationAdRequest mediationAdRequest,
            Bundle customEventExtras) {
        Log.i(LOGTAG, "requestBannerAd() called. " + serverParameter);
        mCebListener = listener;
        
        // according to their release notes, this is how you provide location data to their SDK
        if (mediationAdRequest.getLocation() != null) {   // !!! compiler error; the method doesn't exist
            GSSdkInfo.updateLocation(mediationAdRequest.getLocation());   // !!! compiler error; the method doesn't exist
        }
        
        final GSMobileBannerAdView gsAd = new GSMobileBannerAdView(context, serverParameter);
        gsAd.addListener(this);
        gsAd.refresh();

    }



Eric Leichtenschlag

unread,
Aug 1, 2014, 8:09:10 PM8/1/14
to google-adm...@googlegroups.com
Hi Tony,

This was definitely an oversight. We'll be adding getLocation into com.google.android.gms.ads.MediationAdRequest for the next release. In the meantime, the old custom event APIs should still work if you want to hold off on converting the custom events.

Thanks,
Eric

Tony Chan

unread,
Aug 1, 2014, 8:41:28 PM8/1/14
to google-adm...@googlegroups.com
Excellent, I tried to use the old adapters and they do indeed seem to work still. I'm guessing this is why the old SDK code was included in the new GPS jar as well?

As a side question, since the GPS jar already includes the old SDK code, how can Google Play know if developers are uploading new APKs with the old standalone AdMob sdk? Is it literally going to scan everyone's new APKs as they're uploaded to check for this? Or will developers still technically be able to upload APKs with the old SDK, it's just that they'll be violating the new policy. Or is all this a secret?

Eric Leichtenschlag

unread,
Aug 1, 2014, 10:16:00 PM8/1/14
to google-adm...@googlegroups.com
Google Play services packages the old public com.google.ads.mediation.* and mediation.customevent.* classes to support mediation adapters and custom events written against the standalone SDK. It wouldn't have been feasible to ask every ad network to update their adapters. It doesn't package the entire legacy SDK though.

As for the Google Play policy, the policy violation is checking the device ID for advertising. The mediation classes themselves didn't access the device ID, they just facilitated mediation. The requests to AdMob still run through play services and use the Android advertising ID, so from a policy perspective everything is ok.
Reply all
Reply to author
Forward
0 new messages