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

Request: allow to set template type during runtime #41

Open
AndroidDeveloperLB opened this issue Jul 21, 2023 · 10 comments
Open

Request: allow to set template type during runtime #41

AndroidDeveloperLB opened this issue Jul 21, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Jul 21, 2023

Currently it's available only in layout XML file...

https://developers.google.com/admob/android/native/templates

<com.google.android.ads.nativetemplates.TemplateView...
   app:gnt_template_type="@layout/gnt_small_template_view" ... />

...
@NVentimiglia NVentimiglia self-assigned this Jul 28, 2023
@NVentimiglia
Copy link
Member

Hi @AndroidDeveloperLB

Can you expand further on what you are wanting and your specific use case? Are you asking to construct the template view in code without a xml file ?

@AndroidDeveloperLB
Copy link
Author

@NVentimiglia Sometimes you load an ad that has media, and sometimes you don't.
For example, if you fail to load an ad that has media, you might want to have a fallback to load an ad that doesn't.
Once you have the ad, you will choose which template type to use here. But currently this is only possible via layout XML and not via Java/Kotlin.

@NVentimiglia NVentimiglia added the enhancement New feature or request label Jul 28, 2023
@NVentimiglia
Copy link
Member

@AndroidDeveloperLB

Got it, you would like to define the view in pure Java / Kotlin without the XML file. I will bring this us as a needed enhancement.

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Jul 28, 2023

@NVentimiglia It's not necessary without XML, just the part of the "gnt_template_type" , to be set in Java/Kotlin.
Of course, if there are more things that are only in XML, please consider having them in Java/Kotlin, as well

@JillSong
Copy link
Contributor

JillSong commented Nov 6, 2023

Request recorded. Closing the issue.

@JillSong JillSong closed this as completed Nov 6, 2023
@AndroidDeveloperLB
Copy link
Author

@JillSong Why close? This means it's now possible?

@ericleich
Copy link
Member

@AndroidDeveloperLB from https://support.google.com/admob/answer/6240809, the primary image (media view asset) is guaranteed to be returned. It just may not always have video. Are you saying that if the video is not returned, you don't want to render the primary image?

The way it's defined, it's expected that you know the size of ad you want to render (that is, you know the space made available from your app) at request time.

@ericleich
Copy link
Member

Maybe I misunderstood. Are you ok with specifying it at request time, you just want to be able to do it through code?

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Nov 13, 2023

@ericleich What video/image?
Yes, the request is about the template. That we won't be forced to use as XML, and that we could use code instead, during runtime.

@ericleich ericleich reopened this Nov 14, 2023
@ericleich
Copy link
Member

Nevermind, My initial question didn't make sense.

Agree with the use case: "I want to create a TemplateView and add it to my view hierarchy programmatically." This would require some API to be able to pass the template type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants