Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Companion ads don't show when targeting API 29 #6432

Closed
AlienAsRoger opened this issue Sep 15, 2019 · 11 comments
Closed

Companion ads don't show when targeting API 29 #6432

AlienAsRoger opened this issue Sep 15, 2019 · 11 comments
Assignees

Comments

@AlienAsRoger
Copy link

AlienAsRoger commented Sep 15, 2019

[REQUIRED] Use case description

Provide and example with Companion Ad integration.

Current code have

    /**
     * Sets the slots for displaying companion ads. Individual slots can be created using {@link
     * ImaSdkFactory#createCompanionAdSlot()}.
     *
     * @param companionSlots Slots for displaying companion ads.
     * @see AdDisplayContainer#setCompanionSlots(Collection)
     * @deprecated Use {@code getAdDisplayContainer().setCompanionSlots(...)}.
     */
    @Deprecated
    public void setCompanionSlots(Collection<CompanionAdSlot> companionSlots) {
        adDisplayContainer.setCompanionSlots(companionSlots);
    }

But there is no implementation example. Having Companion Ad integration would help us debug and troubleshoot any issues when it doesn't work on our clients.

Proposed solution

Currently we have in our client code this part

        CompanionAdView companionAdView = companionProvider.getCompanionAdView();
        // Set up spots for companions.
        CompanionAdSlot companionAdSlot = imaFactory.createCompanionAdSlot();
        companionAdSlot.setContainer(companionAdView.getCompanionViewGroup());
        companionAdSlot.setSize(companionAdView.getWidth(), companionAdView.getHeight());

        ArrayList<CompanionAdSlot> companionAdSlots = new ArrayList<>();
        companionAdSlots.add(companionAdSlot);
        adDisplayContainer.setCompanionSlots(companionAdSlots);

Recent update to targetSdk 29 made it impossible to display companion banner( it's shown as blank white). So we were hoping to compare with ExoPlayer IMA integration and check if it's something on our side.

Alternatives considered

I can't think of any alternative solutions.

@AquilesCanta
Copy link
Contributor

@andrewlewis, could you look into this?

@andrewlewis
Copy link
Collaborator

The code from your comment looks right: it should work to call imaAdsLoader.getAdDisplayContainer().setCompanionSlots(slots); to set the slots you've instantiated.

@AlienAsRoger
Copy link
Author

It does work, but we would prefer to have example in ExoPlayer Demo project that would be maintenaned by Google/ExoPlayer team, so anytime something won't work on our side, we would have source of truth.

Another point is to have this under ExoPlayer example is to test compatibility with Android SDK versions. For example we updated to targetSdk version 29, and companion banner isn't showing up properly. Contacting IMA SDK team, we found that they don't use ExoPlayer, but refer to https://github.com/googleads/googleads-ima-android/releases which is different implementation and doesn't work for us. That said it makes harder for us to prove that there is an issue in IMA SDK code, that prevents companion to be shown correctly in combination of ExoPlayer + IMA + Companion Banner

@andrewlewis
Copy link
Collaborator

It sounds strange that this would break when changing targetSdkVersion to 29. Can you reproduce the same thing with the IMA SDK sample app? As regards this feature, I can't think of anything obvious we're doing that could make a difference.

@AlienAsRoger
Copy link
Author

Their IMA SDK Sample doesn't have exact use case. It doesn't render 300x250 ad unit as companion ad banner. It only counts for 320x50 companion ad banner. If I modify their example to render 300x250 ad unit, then it's not working properly.

I don't know what might be different in this case, but it seems like IMA extension for ExoPlayer works different comparing to their sample, as it result in blank white ad unit rending. Please see attached screenshots

This is IMA SDK Sample app with correct container sizes (300x250dp)
device-2019-10-10-083535

This is our sample project with correct companion ad container (300x250dp) + targetSDK 29. It does render correctly if I just change target sdk back to 28(no other changes)
device-2019-10-10-084813

This is our sample project if I change companion banner container to smaller size (320x50dp) to match IMA SDK Sample
device-2019-10-10-084916

So for us it would be much simpler to reference ExoPlayer IMA Demo project where everything setup, rather than providing and maintaining sample projects to prove that something isn't working properly on someone's else side.

@andrewlewis
Copy link
Collaborator

Are you saying that from API 29 the size of the companion slot view makes a difference to whether the companion ad shows up, while when targeting API 28 it shows in both cases?

@AlienAsRoger
Copy link
Author

Yes. If I change target sdk to 29 then it's NOT showing up correctly with container size 300dp x 250dp, but works with smaller size. I didn't experiment with what exact size it should be, since it's breaking our functionality and ad unit requirements.

Having target sdk 28 IMA SDK renders 300dpx250dp ad unit normally.

@andrewlewis
Copy link
Collaborator

For now I'd like to repurpose this issue to track the problem that companion ads don't show when updating to target API 29.

I'm not sure it's worth supporting companion ads in the main ExoPlayer demo app given that the API is pretty simple. Also, in the medium/longer term it's quite likely that at least one of the IMA SDK sample apps will start using the ExoPlayer IMA extension (TBC though).

@ojw28 ojw28 changed the title Provide and example with Companion Ad integration. Companion ads don't show when targeting API 29 Dec 9, 2019
@andrewlewis
Copy link
Collaborator

andrewlewis commented Dec 9, 2019

This is also tracked by [Internal: b/142852592].

@andrewlewis
Copy link
Collaborator

I think the IMA SDK release notes item "Adds scaling for Companion Ads on high-pixel-density devices." may address this and is included in IMA SDK version 3.18.1. The dev-v2 branch has picked that up (but see also the latest reply on #6429 for a caveat). If this is still reproducible on dev-v2 please let me know and I'll reopen the issue.

@google google locked and limited conversation to collaborators Jul 7, 2020
@andrewlewis andrewlewis reopened this Oct 13, 2020
@andrewlewis
Copy link
Collaborator

Note: it looks like this wasn't actually fixed in 3.18.1 but there is a fix coming in the upcoming IMA SDK version 3.20.1.

@ojw28 ojw28 closed this as completed Nov 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants