Request: offer alternatives for UserMessagingPlatform.loadAndShowConsentFormIfRequired to handle UI better

124 views
Skip to first unread message

Liran Barsisa

unread,
Dec 3, 2023, 4:58:52 AM12/3/23
to Google Mobile Ads SDK Developers
Currently it's set to the Activity with a callback, but if the device changes its orientation, the UI is gone as well as the callback and all the things the used has done.

I can overcome this by locking the orientation for this case, for example, but this is only one scenario and it's not a good way to handle UI.

Please ofter other alternatives too, such as starting your own Activity and/or DialogFragment, and support configuration change too.

Liran Barsisa

unread,
Dec 3, 2023, 4:59:51 AM12/3/23
to Google Mobile Ads SDK Developers

Mobile Ads SDK Forum Advisor

unread,
Dec 3, 2023, 8:53:08 PM12/3/23
to lbl...@gmail.com, google-adm...@googlegroups.com

Hi Liran,

Thank you for contacting the Mobile Ads SDK support team.

I understand your concern about losing UI state and callbacks when the device changes orientation with the current setup. Locking the orientation might be a quick fix for this specific case, but it's not ideal for a flexible UI and can limit user experience.

Please note that the APIs are compatible with UMP SDK version 2.1.0 or higher.

After you have received the most up-to-date consent status, call loadAndShowConsentFormIfRequired() on the ConsentForm class to load a consent form. If the consent status is required, the SDK loads a form and immediately presents it from the provided activity. The callback is called after the form is dismissed. If consent is not required, the callback is called immediately.

If you need to perform any actions after the user has made a choice or dismissed the form, place that logic in the callback for your form.

For us to investigate your issue, kindly provide us with the below information privately for further investigation: 

  • app ID 
  • ad unit ID
  • SDK Version being used 
  • Can you elaborate on what "it" refers to in the “Currently it's set to the Activity with a callback” sentence? Is it a specific UI element, a fragment, or the entire activity?
  • What type of callback is being used, and what information does it handle?
  • What happens to the callback data when the activity is recreated due to orientation change?
  • Sample project reproducing the issue

You can provide the following details via reply privately to the author option or directly provide it to the link below.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002qWONJQA4&entry.80707362=00213656

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link. 

This message is in relation to case "ref:!00D1U01174p.!5004Q02qWONJ:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Liran Barsisa

unread,
Dec 4, 2023, 3:18:05 AM12/4/23
to Google Mobile Ads SDK Developers
Guys if you understand the issue why do you need this much details, let alone about specific app details...
I can give you but in private and not here where all can see.
What happens if the user dismisses the dialog?
Any error? What happens in the callback? What happens if I query again and/or request to show the dialog again using  loadAndShowConsentFormIfRequired ?

In any case, please offer better alternatives to this API. It doesn't make sense to have the callbacks this way. UI loses state this way and there is no way to restore it.
We shouldn't be restricted to use this API with Activity, and it shouldn't hold it either. A generic Context should be used. Can even be Application context. 
You need to offer perhaps a DialogFragment or a dedicated Activity (that we can use startActivityForResult) for example. 
Or even a View that we can attach and restore its state.
This reminds me of the times of AsyncTask, which required some annoying steps to make it safe to use. But even then it didn't require to be used in Activity alone, and could be used anywhere you wish.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages