当前位置: 首页 > news >正文

Unity 欧盟UMP用户隐私协议Android接入指南

Unity 欧盟UMP用户协议Android接入指南

    • 官方文档链接
    • 开始接入
      • mainTemplate.gradle 中引入
      • CustomUnityPlayerActivity 导入UMP相关的包
        • java类中新增字段
        • 初始化UMPSDK方法
        • 调用![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/d882171b068c46a1b956e80425f3a9cf.png)
        • 测试
        • 获取测试设备ID
        • 需要和发行沟通一下 开启UMP测试
        • 真机端测试配置环境
        • 接通成功应展示的界面

在这里插入图片描述

官方文档链接

Google 欧盟地区用户意见征求政策 UMPSDK接入文档

开始接入

mainTemplate.gradle 中引入

项目路径下 Assets/Plugins/Android/mainTemplate.gradle
在这里插入图片描述

implementation 'com.google.android.ump:user-messaging-platform:2.1.0'

CustomUnityPlayerActivity 导入UMP相关的包

import com.google.android.ump.ConsentInformation;
import com.google.android.ump.ConsentRequestParameters;
import com.google.android.ump.FormError;
import com.google.android.ump.UserMessagingPlatform;
import com.google.android.ump.ConsentForm;
import com.google.android.ump.ConsentDebugSettings;
java类中新增字段
   private ConsentInformation consentInformation;boolean isUseEEA = false;boolean isUseTestDeivce = false;boolean isResetUMP = false;
初始化UMPSDK方法

在下面代码注释 “加载广告”的地方处理你的开屏广告

 private  void InitUMPSDK(){if(isUseTestDeivce && isUseEEA){   ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this).setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA).addTestDeviceHashedId("TEST-DEVICE-HASHED-ID").build();}// Set tag for under age of consent. false means users are not under age// of consent.ConsentRequestParameters params = new ConsentRequestParameters.Builder().setTagForUnderAgeOfConsent(false).build();consentInformation = UserMessagingPlatform.getConsentInformation(this);consentInformation.requestConsentInfoUpdate(this,params,(ConsentInformation.OnConsentInfoUpdateSuccessListener) () -> {UserMessagingPlatform.loadAndShowConsentFormIfRequired(this,(ConsentForm.OnConsentFormDismissedListener) loadAndShowError -> {if (loadAndShowError != null) {// Consent gathering failed.Log.w(TAG, String.format("%s: %s",loadAndShowError.getErrorCode(),loadAndShowError.getMessage()));}// Consent has been gathered.if (consentInformation.canRequestAds()) {// 在此处加载广告/// tpSplash.showAd();}});},(ConsentInformation.OnConsentInfoUpdateFailureListener) requestConsentError -> {// Consent gathering failed.Log.w(TAG, String.format("%s: %s",requestConsentError.getErrorCode(),requestConsentError.getMessage()));});// Check if you can initialize the Google Mobile Ads SDK in parallel// while checking for new consent information. Consent obtained in// the previous session can be used to request ads.if (consentInformation.canRequestAds()) {// 在此处加载广告/// tpSplash.showAd();}if(isResetUMP){consentInformation.reset();}//记录有没有授权SharedPreferences.Editor editor = sharedPreferences.edit();editor.putBoolean("authorization", true); //editor.apply();}
调用在这里插入图片描述
测试

TEST-DEVICE-HASHED-ID 为你的设备测试ID
在这里插入图片描述

获取测试设备ID

当isUseEEA,isUseTestDeivce,isResetUMP都为true时运行后搜setTestDeviceIds在这里插入图片描述

在这里插入图片描述

需要和发行沟通一下 开启UMP测试

在这里插入图片描述

真机端测试配置环境

开启VPN -选德国节点

接通成功应展示的界面

在这里插入图片描述

http://www.lryc.cn/news/272732.html

相关文章:

  • AutoLisp入门教程
  • matplotlib颜色合集——各种常见简单图形(上)
  • 小H靶场笔记:DC-3
  • Web网页开发-CSS高级技巧2-笔记
  • C++面向对象语法总结(二)
  • 【LeetCode每日一题】2487. 从链表中移除节点(调用栈+递归+翻转链表)
  • 开源协助平台工程灵活应对多云时代的挑战
  • Springboot通过profiles切换不同环境使用的配置
  • SpringBoot入门到精通-Spring Boot Jasypt Encrypt 演示
  • 整数的阶乘(英语:factorial)是所有小于及等于
  • 音视频通信
  • docker 搭建gitlab 恢复和备份
  • 尚硅谷2023版Promise教程从入门到实战(讲师:任安萍)
  • 【SpringBoot】分组校验和自定义校验
  • 19、BLIP-2
  • 【微服务核心】MyBatis Plus
  • 什么是Alibaba Cloud Linux?完全兼容CentOS,详细介绍
  • Spark---RDD算子(单值类型Value)
  • 数据库中的MVCC--多版本并发控制
  • wps将姓名处理格式为:姓**
  • 2023年我的编程之旅:技术演进与自我成长的纪录
  • 好用免费的WAF---如何安装雷池社区版
  • 看似 bug 又非 bug 的一个 bug
  • mysql常见问题
  • QT上位机开发(串口界面设计)
  • k8s之pod
  • 第二百四十三回 再分享一个Json工具
  • electron自定义菜单
  • 变量和函数提升(js的问题)
  • Excel 插件:ASAP Utilities Crack