Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Ad mobile consent popup — Gideros Forum

Ad mobile consent popup

I've mentioned this somewhere else but it needs it own thread just in case you didn't spot it.

From what I could tell there was some breaking changes in 2025 so I suspect the original functionality no longer work as intended.
-(BOOL)checkConsent:(BOOL) reset forUnderAge:(BOOL) underAge
{
    // Create a UMPRequestParameters object.
    UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
    UMPDebugSettings *debugSettings=[[UMPDebugSettings alloc] init];
    debugSettings.testDeviceIdentifiers=<a href="https://forum.gideros.rocks/profile/%5B" rel="nofollow">@[</a> self.testID ];
    parameters.debugSettings=debugSettings;
    // Set tag for under age of consent. NO means users are not under age
    // of consent.
    parameters.tagForUnderAgeOfConsent = underAge;
 
    if (reset)
        [UMPConsentInformation.sharedInstance reset];
    // Request an update for the consent information.
    [UMPConsentInformation.sharedInstance
        requestConsentInfoUpdateWithParameters:parameters
        completionHandler:^(NSError *_Nullable requestConsentError) {
            if (requestConsentError) {
                [AdsClass adConsent:[self class] with:requestConsentError.localizedDescription andCode:(int)requestConsentError.code];
                return;
            }
 
            UMPConsentStatus consentStatus = UMPConsentInformation.sharedInstance.consentStatus;
            if (consentStatus == UMPConsentStatusRequired) {
 
                [UMPConsentForm loadWithCompletionHandler:^(UMPConsentForm * _Nullable consentForm, NSError * _Nullable error) {
                    if (error) {
                        [AdsClass adConsent:[self class] with:error.localizedDescription andCode:(int)error.code];
                        return;
                    }
                    [consentForm presentFromViewController:[AdsClass getRootViewController] completionHandler:^(NSError * _Nullable error) {
                        if (error) {
                            [AdsClass adConsent:[self class] with:error.localizedDescription andCode:(int)error.code];
                            return;
                        }
                        [AdsClass adConsent:[self class] with:<a href="https://forum.gideros.rocks/profile/%22%22" rel="nofollow">@""</a> andCode:0];
                    }];
                }];
 
            }
        }];
    return TRUE;
}
The snippet below is what I added. At the moment when you launch the app, you get the ad consent popup every time which can be annoying to the user.
UMPConsentStatus consentStatus = UMPConsentInformation.sharedInstance.consentStatus;
if (consentStatus == UMPConsentStatusRequired) {
  .....
}
The if block only execute if the following happens:

A) reset is set to true (I've not tested this)
B) You edit the consent form in ad-mob online UX
C) or Google added new ad providers since the user last consented.

At one point I added Unity as a mediator, and as a result, the consent popup reappears so this had been confirmed to work.

Likes: MoKaLux

+1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.