[Android] GAM SDK Jetpack compose Lazy elements

308 views
Skip to first unread message

Nicolas Diaz Lopez

unread,
Oct 4, 2023, 5:51:01 AM10/4/23
to Google Mobile Ads SDK Developers
Our app is based on Jetpack compose and we're struggling to optimize how to present ads from GAM SDK because we think there are not working fine with Lazy elements.

Santiago Londono Diaz

unread,
Oct 5, 2023, 9:39:32 AM10/5/23
to Google Mobile Ads SDK Developers
Dear GAM360 Team,

We are facing a technical issue in our Android application developed with Jetpack Compose. We are using LazyColumn to display content, but we have noticed that when revisiting an ad, the application requests the same ad from the server again, overloading our resources. This doesn't happen when we use Column instead of LazyColumn, but completely switching to Column is not an option.

We are actively seeking a solution to prevent ad reloading when using LazyColumn. Currently, we use AndroidView to display ads since our ad library doesn't have native support for Jetpack Compose.

We would appreciate your suggestions or recommendations for libraries or approaches to resolve this technical issue.

We are using GAM library version: 22.4.0.

Mobile Ads SDK Forum Advisor

unread,
Oct 6, 2023, 3:30:03 AM10/6/23
to nicol...@globant.com, google-adm...@googlegroups.com

Hi,

Thank you for contacting the Mobile Ads SDK Support team.

Upon reviewing your concern, I understand that you are facing an issue with Jetpack Compose.

I will raise a request to add this functionality in the Mobile Ads SDK. I cannot provide a scheduled timeline for the availability of this feature in the Mobile Ads SDK. I would recommend you to please follow our release notes for further updates.

Please feel free to reach back to us if you have further concerns or inquiries.

This message is in relation to case "ref:_00D1U1174p._5004Q2pOiOS:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Cata D.

unread,
Oct 6, 2023, 9:40:49 AM10/6/23
to Google Mobile Ads SDK Developers
We faced a similar issue. If you're using AndroidView then you can try to pass any non null lambda to onReset, otherwise it won't "recycle" it.

" To opt-in for View reuse, call the overload of AndroidView that accepts an onReset callback, and provide a non-null implementation for this callback. Since it is expensive to discard and recreate View instances, reusing Views can lead to noticeable performance improvements — especially when building a scrolling list of AndroidViews. It is highly recommended to opt-in to View reuse when possible."
Reply all
Reply to author
Forward
0 new messages