112

Today i have got this email:

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.

My app is not using the Advertising ID. Should i declare the AD_ID Permission in Manifest or not?

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Abdullah
  • 1,181
  • 2
  • 3
  • 7

11 Answers11

135

Case 1: The app doesn't contain any Ads:

You can simply remove/ignore it by adding tools:node="remove" in the AndroidManifest.xml file.

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

Make sure you have xmlns:tools at the top of AndroidManifest.xml file

Even if another third-party library asks for this specific permission, the build will be forced not to merge it in your final Manifest file. You can get more info from this SO answer.


Case 2: The app contains Ads:

Add the following to AndroidManifest.xml before </manifest>:

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

You can get more information from here.

Rumit Patel
  • 8,830
  • 18
  • 51
  • 70
  • 8
    It dosent's works for me :( – Tanvir Ahmed Jul 28 '22 at 13:11
  • 3
    @TanvirAhmed you can find your final permission in a merged manifest file at `app/build/intermediates/manifests/full/debug/AndroidManifest.xml` – Rumit Patel Jul 29 '22 at 04:36
  • Careful, for me the merged manifest did NOT show the permission.AD_ID. I DID however see it in the decompiled APK and also saw it disappear there when adding the "remove" tag. Hope google play will stop complaining now. – Oliver Metz Sep 14 '22 at 23:29
  • 2
    I am building the app in flutter. And this solution is not working for me. – L.Goyal Sep 26 '22 at 06:38
  • 1
    It' doesn't work for me too... – Christian Oct 15 '22 at 15:52
  • Please elaborate on the statement "Make sure you have xmlns:tools at the top of AndroidManifest.xml file" What exactly does this mean? – Scorb Feb 14 '23 at 20:34
  • @Scorb, `tools:node="remove"` removes `com.google.android.gms.permission.AD_ID` permission from all the manifest files of other libraries at the time of manifest merging. You can find more info from [`tools:node="remove"` Node marker](https://developer.android.com/studio/build/manage-manifests#node_markers), [this SO answer](https://stackoverflow.com/a/5856787/2289835) and [this SO answer](https://stackoverflow.com/a/38202222/2289835). – Rumit Patel Feb 15 '23 at 06:45
  • 1
    if sb wonders about `xmlns:tool`, this is needed: `xmlns:tools="http://schemas.android.com/tools"` – Genix Mar 01 '23 at 15:18
  • I see the permission in merged manifest. How can I find what is adding it there as I haven't used firebase or admob. I searched node_modules, but couldn't find there too. – helloworld Jul 18 '23 at 07:29
  • @helloworld , It can be any of the libraries used in the project. – Rumit Patel Jul 18 '23 at 07:58
  • If you are still having problems while removing the permission from your app: I had to declare the remove tag from above inside both `manifest` and `application` to make all occurrences vanish. Yes, I placed the same line twice inside the `AndroidManifest.xml`. – Malte Peters Jul 20 '23 at 16:25
67

Case 1: Your App has Ads

Add the following to AndroidManifest.xml before </manifest>:

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

Case 2: Your App Doesn't have Ads

At the top of your AndroidManifest.xml make sure you have xmlns:tools on the <manifest ...>. (kudos to this answer) e.g.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mycompany.myapp">

Then, add the following at the bottom of the page, before </manifest> tag:

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

Source:

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Aidin
  • 25,146
  • 8
  • 76
  • 67
  • 5
    It does not work for me :'( I still have the warning about com.google.android.gms.permission.AD_ID – Chloé Aug 07 '22 at 02:01
  • Your Source gives me this error "Service Unavailable" – Greg T Aug 22 '22 at 23:22
  • Adding `xmlns:tools="http://schemas.android.com/tools"` is important. Without it, my app would fail to compile. Thanks! – Isuru Jun 11 '23 at 08:49
  • 1
    If you are still having problems while removing the permission from your app: I had to declare the remove tag from above inside both `manifest` and `application` to make all occurrences vanish. Yes, I placed the same line twice inside the `AndroidManifest.xml`. – Malte Peters Jul 20 '23 at 16:25
42

If your app uses the Google Mobile Ads SDK(Admob) version 20.4.0 or higher, you can skip setting up the permission manually since the SDK automatically declares it

More informations here:

https://developers.google.com/admob/android/quick-start

  • Yes, you are right bro, I'm using the latest Admob Sdk , i have checked my app merged manifest and found that the AD_ID Permission is exist, – Abdullah Mar 14 '22 at 21:42
  • 3
    My app doesn't contain ads still I need to add this ? – Ysp Mar 15 '22 at 04:30
  • @Ysp , If your app don't contain Ads , then you don't have to do this. – Umeshkumar D. Mar 15 '22 at 05:14
  • The answer to this may be stupidly obvious, but it would be good to have clarification; I use AdMob through Firebase thusly: `implementation 'com.google.firebase:firebase-ads:20.6.0'` - as its version 20.6.0 I'm sure it's fine - but as its a redirect from Firebase I'd just like to know it's using AdMob's latest SDK? – Jon Mar 15 '22 at 09:28
  • @Jonathan that's not important if firebase uses the latest version or not as long as it version is higher than `20.4.0 ` – ABDERRAHMANE OUALI Mar 15 '22 at 10:37
  • My app doesn't target Android 13, it targets Android 10, API Level: 29. Should I declare AD_ID(by ugrading Admob SDK or Manifest)? (Besides, my Admob SDK is: play-services-ads:19.0.0) – gurkan stack Mar 29 '22 at 17:57
  • @gurkanstack you should upgrade admob version to the latest version to avoid manual setting – ABDERRAHMANE OUALI Mar 30 '22 at 19:15
  • Thanks for your response but I'm talking about targetSDK in Manifest. I don't think it is obligation to upgrade admob version or add ad_id to manifest if your app targets Android 10, API:29. – gurkan stack Mar 31 '22 at 06:18
  • "Quick Start" from Google have this line "(Optional) Declare AD_ID permission for previous versions to work with Android 13." and just open it to update manifest for old version of Admob is good enough. Thanks friend. – Phuc Jun 21 '22 at 09:45
  • If just use the `Play Services-ads`, can we just select No for the setup? – Ben Aug 20 '22 at 02:11
  • @Ysp, You can look at [this answer](https://stackoverflow.com/a/73132765/2289835) if your app doesn't contain ads. – Rumit Patel Dec 03 '22 at 04:15
31

In my case, I used Firebase Analytics only for crash reports etc.

You can set your app to use advertising ID.

enter image description here

And use Analytics only.

enter image description here

Cyber
  • 2,194
  • 4
  • 22
  • 41
27

Google describe here how to solve

https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

Add in manifest

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Bruno Morais
  • 431
  • 4
  • 5
  • 1
    So we have to update all of our apps adding this permission? And what happen if we don't update our apps? – joan16v Mar 15 '22 at 06:03
  • Can I use AD_ID variable, e.g. like this `` ? Thanks – spcsLrg Mar 15 '22 at 10:31
  • @spcsLrg, No need ,, Just add – Suhad Bin Zubair Mar 17 '22 at 12:03
  • 1
    @joan16v it was requirements from Google if your build target api from 31. Check here https://developers.google.com/interactive-media-ads/docs/sdks/android/dai/android-12 . You don't have to do anything if your target api still <= 30 – Phuc Jun 21 '22 at 13:08
25

If your app doesn't contain ads, make sure you complete the survey on App content page (Policy > App content) in Play Console.

Just select the option: No, my app does not contain ads.

If you don't do that, you won't be able to upload new releases of your app to Google Play.

Google Play Console Ad Selector Location

jaredbaszler
  • 3,941
  • 2
  • 32
  • 40
Vadik Sirekanyan
  • 3,332
  • 1
  • 22
  • 29
16

First of all,
com.google.android.gms.permission.AD_ID can be added by other third party SDK like

  • Play Services-ads
  • firebase-analytics etc

So, if you haven't added permission.AD_ID manually, make sure it is not added by any other SDK by checking merged manifest file.

merged-manifest path:
project > app > build > intermediate > merged_manifest > release > AndroidManifest.xml

Now go to your play console > app content > Adverstising ID and

  • Select NO if your merged manifest doesn't contain AD_ID, else
  • Select YES and complete next option.
Abu Saeed
  • 1,020
  • 8
  • 21
10

Don't worry. All developer who uses Admob for advertisement received this warning. Just make sure you are using Latest Google Mobile Ads SDK(Admob) OR AdMob SDK version higher or equal to 20.4.0 in your build.gradle file. In that case SDK automatically manage it.

Otherwise for older sdk below 20.4.0, we need to manually mention below line in our AndroidManifest.xml

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Umeshkumar D.
  • 412
  • 4
  • 18
8

There are two different forms:

  1. Ads
  2. Advertising ID

Initially, I got stuck because I did not notice the other. So your app can be in any combination, for example, no ads, but yes, advertising ID.

In this documentation it is explained that Google services can include the advertising ID for other reasons that are not ads: Analytics.

Google Play Services version 4.0 introduced new APIs and an ID for use by advertising and analytics providers. Terms for the use of this ID are below.

And in this other documentation, in the examples section is very clear that ads are understood as what is commonly understood as ads: banners, pop-ups, a tile in the middle of a list, etc.

Analyzing the merged manifest we can see that the library play-services-measurement-api is adding the permission and is related to Analytics. The library manifest looks like this:

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

    <application>
        <service
            android:name="com.google.firebase.components.ComponentDiscoveryService"
            android:exported="false" >
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
        </service>
    </application>

Please notice that library is registering analytics.connector.internal.AnalyticsConnectorRegistrar.

In this case the Ads form must be mark with no but the Adverising ID form must be mark with yes and then the Analytics option.

I have seen people recommending force the manifest to not merge the permission.AD_ID but that would break the Analytics.

cutiko
  • 9,887
  • 3
  • 45
  • 59
  • 2
    This actually is the right answer - the difference between Ads & Advertising ID. Thanks for this hint - solved my problem. – 5ulo Oct 19 '22 at 10:08
  • 2
    It is confusing because why would the advertising ID would be included by default in Analytics? Seems like a misnomer to me, if not reading multiple documentations is hard to figure it out @5ulo – cutiko Oct 19 '22 at 17:42
3

I also received today's mail from the PlayStore team to all developers. Asking to declare AD_ID permission. Since we developed and released our application using Flutter with android targeting to API level 31. I'm using the advertising_identifier: ^0.1.1 plugin to get the advertising client ID. I haven't declared AD_ID permission in my manifest file.

Additionally, apps updating their target API level to 31 (Android 12) and using advertise identifier / advertise id client info fetch will need to declare a Google Play services normal permission in the manifest file as follows:

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

Refered,

https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

Jai Techie
  • 1,657
  • 3
  • 14
  • 36
  • 1
    My app is developed using Flutter, I don't use any ad plugins like advertising_identifier. Should I add permission line in manifest file without changing AD_ID? What is AD_ID? Is there any thing to do for my flutter app related to "Action requested: Declare your Ad ID permission"? – blue492 Mar 15 '22 at 10:56
  • 2
    AD_ID(Advertising ID) is the unique ID to track the user's movements & usages of applications. To access the application adID on iOS ASIdentifierManger.advertisingIdentifier and advertisingID on Android. As per the google play service doc, this AD_ID permission will be enforced starting from April 1st, 2022 for all devices. Android 12 users have the feature to delete their phones Advertising ID. So that's why android targeting level to 31 and more must need to provide permission to access the AD_ID. If your app doesn't contain ads not required to give. – Jai Techie Mar 15 '22 at 14:26
3

when you set targetSdkVersion 33 you must need to add the below line in the manifest file

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

if you are not set this, show a warning on the play console when your is in production.

Jayesh Dankhara
  • 525
  • 7
  • 8