【问题标题】:How to add 'Google Consent 'to flutter app如何在 Flutter 应用中添加“Google 同意”
【发布时间】:2020-09-11 14:01:36
【问题描述】:

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

我现在如何添加此链接https://developers.google.com/admob/ump/android/quick-start 下描述的信息?

我尝试使用https://pub.dev/packages/gdpr_dialog 运行,但这只是英文。

【问题讨论】:

  • 检查this插件
  • @Rajen Raiyarela 我试过了,但是从这个页面复制示例代码我仍然无法调用对话框。此外,我没有看到个性化语言的选项,因此消息是波兰语。

标签: android flutter dart admob


【解决方案1】:

主要

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

在波兰语中使用

如果您想在波兰语中使用该插件,而无需创建 Google Founding Choices 帐户,则需要使用此版本的Plugin

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

来自此提交的 README.md here

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

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

因此,如果目标群体只有波兰语,我会建议研究一种,例如英语,然后调用它。 (您要查找的代码 sn-p 在文件的基础上。)

【讨论】:

  • 如何设置波兰语消息?
  • 我没有文件夹“资产”。哪里可以写波兰语?
  • 所以,我又修改了一遍,我用错了pubspec.yaml的安装行。我也更详细地再次解释了它。 ; )
猜你喜欢
  • 2020-05-20
  • 2020-04-07
  • 2020-09-05
  • 1970-01-01
  • 2020-01-05
  • 2019-03-14
  • 2021-11-22
  • 2022-01-10
  • 1970-01-01
相关资源
最近更新 更多