How to add 'Google Consent 'to flutter app
Main
pubspec.yaml
dependencies:
admob_consent: '1.0.0' #if you will change the text
admob_consent: ^1.0.0+1 #if you will use main
initialization
import 'package:flutter/material.dart';
import 'package:admob_consent/admob_consent.dart';
final AdmobConsent _admobConsent = AdmobConsent();
_admobConsent.show(publisherId: "REPLACE_WITH_YOUR_PUBLISHER_ID", privacyURL: "URL_TO_YOUR_PRIVACY_POLICY");
Listener
You can listen to the onConsentFormLoaded
, onConsentFormOpened
, onConsentFormClosed
and onConsentFormError
streams.
_admobConsent.onConsentFormClosed.listen((bool status) {
// Status true if personalized
// Handle it, ie. set targetingInfo
});
To use in Polish
When you want to use the plugin in polish, without creating a Google Founding Choices account, you need to use this version of the Plugin
Version: '1.0.0' (not the newest)
README.md from this commit here
Here you can edit the language files (External Libraries/Flutter Plugins/admob_consent-1.0.0/android/src.main/assets)
There are a couple html files, these represent the consent query. You can either copy and revise one of these, but then you have to make sure that you also integrate them.
Therefore, if the target group is only Polish, I would recommend working on one, for example English, and calling it up. (The code snippet you are looking for is at the ground of the files.)
Captivity
Software developer, designer, webdev. Symfony, BPMS, BPM.
Updated on December 24, 2022Comments
-
Captivity over 1 year
In my application I use native ads from:
firebase_admob, native_admob_controller, flutter_native_admob
.child: NativeAdmob( // Your ad unit id adUnitID: adsAndroidID, controller: _nativeAdController, // Don't show loading widget when in loading state ),
How can I now add to it the information described under this link https://developers.google.com/admob/ump/android/quick-start ?
I trying run with https://pub.dev/packages/gdpr_dialog but this is only in english language.
-
Captivity over 3 yearsHow to set a message in Polish?
-
Captivity over 3 yearsI dont have folder "assets". Where I can write text in polish?
-
m123 over 3 yearsSo, I revised it again, I had used the wrong installation line for pubspec.yaml. I also explained it again in more detail. ; )