Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue of cordova.plugins.emiAdmobPlugin.requestIDFA() #57

Open
wuxiaomo6174 opened this issue Jan 22, 2025 · 6 comments
Open

Issue of cordova.plugins.emiAdmobPlugin.requestIDFA() #57

wuxiaomo6174 opened this issue Jan 22, 2025 · 6 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@wuxiaomo6174
Copy link

I meet 3 issues of using cordova.plugins.emiAdmobPlugin.requestIDFA().

Env is: Capacitor 6.0 + IOS 18.2.1 + Xcode 16.2 + 2.0.5 version

  1. When execute "cordova.plugins.emiAdmobPlugin.requestIDFA()", no IDFA explainer message showed in real iphone device. But it can showed in virtual xcode simulator. When we has done some IDFA configure in Admob, the IDFA explainer message shoule come after we call this function.

  2. The iOS ATT Alert come first than IDFA explainer message in xcode simulator. According to Admob document, the order should be as following:
    Image

We should get explainer message firstly.

3.Different behavior in real device with simulator. If we create a IDFA expaliner message in Admob, then we do not call cordova.plugins.emiAdmobPlugin.requestIDFA(). Yes, do not call this function! We could get a right order in simulator. IDFA explainer message comes firstly, then show ATT alert. However, we will get nothing in real device. This is not a right behavior.

@EMI-INDO
Copy link
Owner

@wuxiaomo6174

I don't have iphone/ipad, I'm a poor person can't buy expensive phone, what else iphone/ipad with IOS 14 +

To test it on a real device.

  • Delete the previous app on the real device if any,
    Install it again.

  • Make sure the test device has a minimum of IOS 14 or higher.

  • In the test application display the response output data.attStatus;

example

document.addEventListener('on.sdkInitialization', (data) => {

        const attStatus = data.attStatus;
       
        alert(attStatus)

    });

  • Tell me the output of the response data.attStatus;

  • Example with callback

if (isPlatformIOS) {
    try {
        cordova.plugins.emiAdmobPlugin.requestIDFA(
            (result) => {
                console.log("IDFA request successful:", result);
                // Display the response to a textarea and similar
            },
            (error) => {
                console.error("IDFA request failed:", error);
                // Display the response to a textarea and similar
            }
        );
    } catch (error) {
        console.error("An unexpected error occurred while requesting IDFA:", error.message || error);
       // Display the response to a textarea and similar
    }
}

@EMI-INDO EMI-INDO self-assigned this Jan 22, 2025
@EMI-INDO EMI-INDO added the help wanted Extra attention is needed label Jan 22, 2025
@EMI-INDO
Copy link
Owner

EMI-INDO commented Jan 22, 2025

@wuxiaomo6174 @merbin2012

  • If it works, it is only displayed once, to display it again you have to uninstall the app and reinstall it.

  • If you want to be more complete like this, you can restrict access to the app based on conditions selected by the user.

if (isPlatformIOS) {
    try {
        cordova.plugins.emiAdmobPlugin.requestIDFA(
            (result) => {
                // Handle IDFA status based on result value
                switch (result) {
                    case 0: // ATTrackingManagerAuthorizationStatusDenied
                        console.log("IDFA access denied: User did not allow tracking.");
                        break;
                    case 1: // ATTrackingManagerAuthorizationStatusAuthorized
                        console.log("IDFA access granted: User allowed tracking.");
                        break;
                    case 2: // ATTrackingManagerAuthorizationStatusRestricted
                        console.log("IDFA restricted: Tracking not available.");
                        break;
                    case 3: // ATTrackingManagerAuthorizationStatusNotDetermined
                        console.log("IDFA not determined: User hasn't made a choice yet.");
                        break;
                    default:
                        console.error("Unknown IDFA status:", result);
                }
            },
            (error) => {
                console.error("Failed to request IDFA:", error);
            }
        );
    } catch (error) {
        console.error("An unexpected error occurred while requesting IDFA:", error.message || error);
    }
} else {
    console.log("Platform is not iOS. IDFA request skipped.");
}

this condition also applies or is the same as data.attStatus

@wuxiaomo6174
Copy link
Author

@EMI-INDO
Hi, I do some tests in my env.
Test 1:
The result of attStatus is following:
In xcode virtual device:
The attStatus is: 3
In real iphone 18.2.1:
It will not enter on.sdkInitialization function. It hasn't executed.

Test 2:
And another test of requestIDFA,
switch (result), the result always is 0 with any device.

In my reported bug, IDFA explainer message (dialog 1) has not showing in real device.

Image

@EMI-INDO
Copy link
Owner

  • Have you checked if the “Allow Apps to Request Tracking” button is active on your iOS device?

https://youtu.be/Uz1ZlJNGnn4?si=0nYBOF1wke4vxExh

@EMI-INDO
Copy link
Owner

1:

Make sure your application has completely finished loading, displayed to the main page of the application, then call the function requestIDFA

2:

you can try adding a little pause before the requestIDFA function is called.

3:

Solving this problem will be a little difficult because I don't have the original iphone device🙏

@EMI-INDO
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants