如何将'Google Consent'添加到flutter app

How to add 'Google Consent 'to flutter app

在我的应用程序中,我使用了以下来源的原生广告: 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
            ),

现在如何向其中添加此 link https://developers.google.com/admob/ump/android/quick-start 下描述的信息?

我正在尝试 运行 和 https://pub.dev/packages/gdpr_dialog 但这只有英语。

主要

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

初始化

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");

听众

您可以收听 onConsentFormLoadedonConsentFormOpenedonConsentFormClosedonConsentFormError 流。

_admobConsent.onConsentFormClosed.listen((bool status) {
    // Status true if personalized
    // Handle it, ie. set targetingInfo
});

使用波兰语

如果您想使用 polish 插件而不创建 Google Founding Choices 帐户,您需要使用 此版本的 Plugin

版本:'1.0.0'(不是最新的)

README.md 来自此提交 here

在这里您可以编辑语言文件 (外部Libraries/FlutterPlugins/admob_consent-1.0.0/android/src.main/assets)

有几个 html 文件,它们代表同意查询。您可以复制和修改其中之一,但是您必须确保您也整合了它们。

因此,如果目标群体仅是波兰语,我会建议研究一个,例如英语,然后调用它。 (您要查找的代码片段位于文件底部。)