setConsent for iOS and Android, too
gasci opened this issue · comments
Plugin(s)
- Analytics
- App
- App Check
- Authentication
- Crashlytics
- Cloud Firestore
- Cloud Messaging
- Cloud Storage
- Performance
- Remote Config
Current problem
Is the setConsent
method 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
- I have read and followed the feature request guidelines.
- I have attached links to possibly related issues and discussions.
This method is already available on Android and iOS. Please note, that the latest version has a bug which is fixed in #635.
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?
You can use this dev release:
npm i @capacitor-firebase/analytics@6.0.0-dev.f140e0b.1718628059
Thank you.
@robingenz could you publish another dev build in favor of the recent ios fix regarding the setConsent method?
npm i @capacitor-firebase/analytics@6.0.0-dev.5ab166a.1720001083
Is it possible to set multiple consents at once? @robingenz
@gasci No, this is not yet possible.
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
});
}
}
@gasci Please create a bug report and provide all the information you have (logs, etc.).
Done:
#671