【Google Play】声明广告权限 ( you must declare the AD_ID Permission when your app targets Android 13 )



文章目录






一、广告权限申请要求



今天收到 Google Play 邮件 , 要求添加

【Google Play】声明广告权限 ( you must declare the AD_ID Permission when your app targets Android 13 )_应用程序

邮件原文 :

Hello Google Play Developer,

Last July, we announced Advertising policy changes to help bolster security and privacy. We added new restrictions on identifiers used by apps that target children.

When users choose to delete their advertising ID in order to opt out of personalization advertising, developers will receive a string of zeros instead of the identifier if they attempt to access the identifier. This behavior will extend to phones, tablets, and Android TV starting April 1, 2022.

We also announced that you need to declare an AD_ID permission when you update your app targeting API level to 31 (Android 12). Today, we are sharing that we will give developers more time to ease the transition. We will require this permission declaration when your apps are able to target Android 13 instead of starting with Android 12.

Action Items

If you use an advertising ID, you must declare the AD_ID Permission when your app targets Android 13 or above. Apps that don’t declare the permission will get a string of zeros. Note: You’ll be able to target Android 13 later this year.

If your app uses an SDK that has declared the Ad ID permission, it will acquire the permission declaration through manifest merge.

If your app’s target audience includes children, you must not transmit Android Advertising ID (AAID) from children or users of unknown age. Learn more.

机翻内容 ( 仅做参考 ) :

你好,谷歌游戏开发者,

去年7月,我们宣布改变广告政策,以帮助加强安全和隐私。我们对针对儿童的应用程序使用的标识符增加了新的限制。

当用户选择删除他们的广告ID以退出个性化广告时,如果开发者试图访问标识符,他们将收到一个由零组成的字符串,而不是标识符。这种行为将从2022年4月1日起扩展到手机、平板电脑和安卓电视。

我们还宣布,当您将应用程序目标API级别更新为31(Android 12)时,您需要声明AD_ID权限。今天,我们分享我们将给开发者更多的时间来简化过渡。当你的应用能够以安卓13为目标,而不是以安卓12为起点时,我们将需要此权限声明。

行动项目

如果你使用广告ID,当你的应用针对Android 13或更高版本时,你必须声明广告ID权限。未声明权限的应用程序将得到一串零。注:今年晚些时候,你将能够瞄准Android 13。

如果你的应用程序使用的SDK已经声明了Ad ID权限,它将通过清单合并获取权限声明。

如果你的应用程序的目标受众包括儿童,你不能从儿童或未知年龄的用户那里传输Android广告ID(AAID)。了解更多。






二、添加广告权限



对应的文档地址 : ​https://support.google.com/googleplay/android-developer/answer/6048248​

【Google Play】声明广告权限 ( you must declare the AD_ID Permission when your app targets Android 13 )_android studio_02

在 AndroidManifest.xml 中声明

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

权限即可 ;

完整清单文件参考 :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ad_id_test">

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AD_ID_Test">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

完整 build.gradle 参考 : 核心是 ​ ​targetSdkVersion 31​ ​ ;

plugins {
id 'com.android.application'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.ad_id_test"
minSdkVersion 18
targetSdkVersion 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}



【报错信息】Google Play 上架报错 ( Your app contains ads that do not comply with our Families ad | 退出亲子同乐计划 )

一、报错信息、二、向 Google Play 政策团队询问细节信息、三、解决方案 ( 暂时 )、

Your content must have a ListView whose id attribute is 'android.R.id.list' 【Android 报错】

周六,在APP中增加一个加载列表的功能时报错:Your content have a ListView whose id attribute is 'android.R.id.list'