EMI-INDO / emi-indo-cordova-plugin-admob

Cordova Plugin Admob Android | IOS
ISC License
12 stars 2 forks source link

Event on.get.consent.status not launched / Help needed #22

Open hooliapps opened 2 months ago

hooliapps commented 2 months ago

Hello

I'm migrating from Cordova (ios) admob plus plugin to this plugin.

I'm trying to use the following code, but i have some problems.

// 1. Init global settings cordova.plugins.emiAdmobPlugin.globalSettings(A.admobConfigGlobalSettings);

// 2. Init targeting cordova.plugins.emiAdmobPlugin.targeting(A.admobConfigTargeting);

// 3 Create Event SDK Init document.addEventListener('on.sdkInitialization', function() {

// 3a. I want to ask for iOS14 ATT 
cordova.plugins.emiAdmobPlugin.requestIDFA(
    function(trackingAuthorizationStatus) {
        console.log('trackingAuthorizationStatus:'+trackingAuthorizationStatus);

        // 3b. I want to ask for Consent form if needed
        cordova.plugins.emiAdmobPlugin.getConsentRequest(
            function(consentStatus) {
                console.log('consentStatus:'+consentStatus);
            },
            function(error) {
                console.log('error:'+error);
            }
        );

    },
    function(error) {
        console.log('error:'+error);
    }
);

});

// 4. Create Event On TCString expired : Force Consent GDPR document.addEventListener('on.TCString.expired', function() { cordova.plugins.emiAdmobPlugin.consentReset(); });

// 5. When i get consent status --> Prepare Ads document.addEventListener('on.get.consent.status', function() { A.startSdks(); });

// 6. Init Admob plugin cordova.plugins.emiAdmobPlugin.initialize();

Best regards

EMI-INDO commented 2 months ago

@hooliapps

I made a little example, like this.

https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/ump_att.html

hooliapps commented 2 months ago

Thanks a lot i will try.

hooliapps commented 2 months ago

Hello.

I did tests.

At first execution, both forms ATT/CMP are displayed (ok), but on.sdkInitialization event is not launched. I stop/restart app, then on.sdkInitialization is correctly launched.

Best regards

emi415064 commented 2 months ago
if (status === 0) {

} else if (status === 1) {

} else if (status === 2) {

} else if (status === 3) {

} 

https://developers.google.com/admob/android/privacy/api/reference/com/google/android/ump/ConsentInformation.ConsentStatus

hooliapps commented 2 months ago

Where can i put this code please ?

I tried to add any code after the initialize part (even with await) then code is launched immediatly when show is displayed, so before user make his choice (click buttons/close forms).

EMI-INDO commented 1 month ago

// Here UMP status // Whatever the status is install admob sdk

                       if (status === 0) {

} else if (status === 1) {

} else if (status === 2) {

} else if (status === 3) {

}

https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/ump_att.html