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

setConsent for iOS and Android, too #641

Closed
3 of 12 tasks
gasci opened this issue Jun 17, 2024 · 11 comments
Closed
3 of 12 tasks

setConsent for iOS and Android, too #641

gasci opened this issue Jun 17, 2024 · 11 comments

Comments

@gasci
Copy link

gasci commented Jun 17, 2024

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Current problem

Is the setConsentmethod available only for web?
https://support.google.com/google-ads/answer/10000067?hl=en

Preferred solution

It would be great if we could implement the setConsent for iOS and Android.
https://support.google.com/google-ads/answer/10000067?hl=en

Alternative options

No response

Additional context

No response

Before submitting

@gasci gasci changed the title feat: setConsent for iOS and Android, too Jun 17, 2024
@robingenz
Copy link
Member

This method is already available on Android and iOS. Please note, that the latest version has a bug which is fixed in #635.

@gasci
Copy link
Author

gasci commented Jun 17, 2024

Thank you for the quick answer. What version should I use to be able to use this method with iOS and Android, then? Should wait for a new version 6.x?

@robingenz
Copy link
Member

You can use this dev release:

npm i @capacitor-firebase/analytics@6.0.0-dev.f140e0b.1718628059

@gasci
Copy link
Author

gasci commented Jun 17, 2024

Thank you.

@AE1NS
Copy link
Contributor

AE1NS commented Jul 3, 2024

@robingenz could you publish another dev build in favor of the recent ios fix regarding the setConsent method?

@robingenz
Copy link
Member

@AE1NS

npm i @capacitor-firebase/analytics@6.0.0-dev.5ab166a.1720001083

@gasci
Copy link
Author

gasci commented Jul 4, 2024

Is it possible to set multiple consents at once? @robingenz

@robingenz
Copy link
Member

@gasci No, this is not yet possible.

@gasci
Copy link
Author

gasci commented Jul 4, 2024

When I try to put 5 types of consents into a for loop multiple await statements crash the app unfortunately. That feature would be really useful.

if (isPlatform(["web", "android", "ios"])) {
    const consent = await Preferences.get({ key: 'cookieConsent' });
    const consentTypes = [
      { type: ConsentType.AdPersonalization },
      { type: ConsentType.PersonalizationStorage },
      { type: ConsentType.AdUserData },
      { type: ConsentType.AdStorage },
      { type: ConsentType.AnalyticsStorage },
    ];

    for (let consentType of consentTypes) {
      await FirebaseAnalytics.setConsent({
        type: consentType,
        status: consent.value === 'authorized' ? ConsentStatus.Granted : ConsentStatus.Denied
      });
    }
  }

@robingenz
Copy link
Member

@gasci Please create a bug report and provide all the information you have (logs, etc.).

@gasci
Copy link
Author

gasci commented Jul 4, 2024

Done:
#671

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants