Merge pull request #6120 from alexzatsepin/MAPSME-4555-fix-mopub-show-tracking-on-master

[cherry-pick] [android] Fixed Mopub ad's shows tracking
This commit is contained in:
Arsentiy Milchakov 2017-05-25 15:44:17 +03:00 committed by GitHub
commit 27a5f901f6
3 changed files with 11 additions and 3 deletions

View file

@ -73,7 +73,15 @@ public class CompoundNativeAdLoader extends BaseNativeAdLoader implements Native
mLoaders.add(loader);
attach();
loader.setAdListener(this);
loader.loadAd(context, banner.getId());
// TODO: this workaround is need to avoid memory leak of activity context in MyTarget SDK.
// The fix of myTarged sdk will be done in this issue https://jira.mail.ru/browse/MOBADS-207.
// After the mentioned issued is fixed, this workaround should be removed. Also, we can't use
// the application context for all providers, because some of them (e.g. Mopub) requires an
// activity context and can't work with application context correctly.
if (loader instanceof MyTargetAdsLoader)
loader.loadAd(context.getApplicationContext(), banner.getId());
else
loader.loadAd(context, banner.getId());
}
}

View file

@ -95,7 +95,7 @@ class MopubNativeDownloader extends CachingNativeAdLoader
@Override
public void onAdImpressed()
{
// No op.
LOGGER.d(TAG, "on MoPub Ad impressed");
}
@Override

View file

@ -186,7 +186,7 @@ final class BannerController
}
UiUtils.show(mFrame);
mAdsLoader.loadAd(MwmApplication.get(), mBanners);
mAdsLoader.loadAd(mFrame.getContext(), mBanners);
updateVisibility();
}