Request: use Context instead of Activity when it doesn't require UI, for all consent-related API

121 views
Skip to first unread message

Liran Barsisa

unread,
Sep 2, 2023, 7:18:57 AM9/2/23
to Google Mobile Ads SDK Developers
I'm talking about this:
https://developers.google.com/admob/android/privacy

I've noticed that some APIs there require Activity even though they don't need to, and even though it can lead to memory leaks.
We should be able to fetch the consent requirement in the background, using even Application as parameter for requestConsentInfoUpdate , for example.

Please provide a way to avoid having an Activity for this and for every other place.
This can also help loading the status before we show the UI even if it's on a different Activity, and also save it for next time.

Liran Barsisa

unread,
Sep 2, 2023, 7:19:24 AM9/2/23
to Google Mobile Ads SDK Developers

It can also be used in ViewModel instead of right inside Fragment/Activity.

Mobile Ads SDK Forum Advisor

unread,
Sep 4, 2023, 6:00:57 AM9/4/23
to lbl...@gmail.com, google-adm...@googlegroups.com
Hi Liran,

Thank you for reaching out to us.

With regard to your concern, I'm afraid that this is currently the design of the Mobile Ads SDK. However, we're open to any suggestion to our publishers when it comes to the flexibility of the SDK. What I can do to this point is to submit your use case as a feature request. In order for us to proceed, kindly provide to us your business use case (or benefit) to the said feature/functionality. In addition, please share to us your AdMob App ID as well.
 
This message is in relation to case "ref:_00D1U1174p._5004Q2oAQOM:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Liran Barsisa

unread,
Sep 4, 2023, 6:06:49 AM9/4/23
to Google Mobile Ads SDK Developers
It is a feature request.
It's just weird that in places that don't have UI - they need Activity instead of just any kind of Context.
Please consider changing it.

Liran Barsisa

unread,
Sep 4, 2023, 6:10:40 AM9/4/23
to Google Mobile Ads SDK Developers
Also why do you need "business use case (or benefit)" and "Admob App ID" ? I've explained already the use cases and the benefits:
1. Loading the state properly, outside of UI, before using it.
2. Be able to handle this in ViewModel or somewhere else.
3. Be able to load this even in Service, when there is no UI yet, or even when upgrading the app.
4. Be able to avoid memory leaks as this is callback that can arrive when leaving the Activity
5. This is just more correct way to do, as some functions don't need UI, yet they load in the background.

I don't want to publish here app IDs. Everyone can see it.

Mobile Ads SDK Forum Advisor

unread,
Sep 4, 2023, 9:56:04 AM9/4/23
to lbl...@gmail.com, google-adm...@googlegroups.com
Hello Liran,

Thank you for your input. We will now be forwarding your concerns to the wider team for a feature request. You may keep an eye on our blog (https://ads-developers.googleblog.com/search/label/admob) for any future updates on this.

Pierfrancesco Soffritti

unread,
Nov 26, 2023, 10:06:18 PM11/26/23
to Google Mobile Ads SDK Developers
+1, I think we are actually leaking the Activity on configuration changes, according to Leak Canary.
Reply all
Reply to author
Forward
0 new messages