Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question [Solved] Google Advertising ID permission

Discussion in 'Android' started by Limewood_, Nov 18, 2022.

  1. Limewood_

    Limewood_

    Joined:
    Jan 5, 2020
    Posts:
    62
    I'm using Analytics and IAP, but no Ads.
    Still, the AD_ID permission gets added to the manifest for my Google builds.
    I've tried to find info on this by searching the forums and the only answers I could find said that Unity does not use the advertising ID for Analytics/IAP, so why is it added in the manifest?
    Do I need to change some setting to make it not be added?

    Some additional information:
    I'm getting this error when uploading an app bundle to Google Play:
    Code (CSharp):
    1. This release includes the com.google.android.gms.permission.AD_ID permission but your declaration on Play Console says that your app doesn't use advertising ID.
    2.  
    3. You must update your advertising ID declaration.
    I've found the permission declaration in the following AndroidManifest files, created by Unity:
    Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/bundle_manifest/release/bundle-manifest/AndroidManifest.xml
    Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/instant_app_manifest/release/AndroidManifest.xml
    Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/merged_manifests/release/AndroidManifest.xml

    I also found the following aar file in Assets/Plugins/Android:
    com.google.android.gms.play-services-ads-identifier-18.0.0.aar
    It contains a manifest with the AD_ID permission. Why is this included?
    EDIT: I've also found that several of the "measurement-api/sdk" libraries in this folder contain the permission declaration as well. Has maybe Unity changed and the advertising ID is now required?

    Further, if I change the choice in Google Play to say that I use the Advertising ID, I now get the following error, saying I don't have it in the manifest:
    Code (CSharp):
    1. Your declaration on Play Console says that your app uses advertising ID. Your manifest file doesn't include the com.google.android.gms.permission.AD_ID permission.
     
    Last edited: Nov 18, 2022
    Cuicui_Studios likes this.
  2. Limewood_

    Limewood_

    Joined:
    Jan 5, 2020
    Posts:
    62
    Update: Apparently the libraries containing the AD_ID permission were added some time ago when I imported some feature in Unity (not ads, though, since I've never touched that), but they were all removed when I did a clean build and Google now accepts the bundle.
     
  3. Limewood_

    Limewood_

    Joined:
    Jan 5, 2020
    Posts:
    62
    Well, it turns out it wasn't solved after all. I found out there is a "Unity Analytics" as well, which I don't want to use, but it confused me and I had to jump through multiple hoops to get Unity with Firebase working again and when I finally did I get the same error. It doesn't appear to be on Unity's side, though, since the AD_ID permission is shown even in the Google Play console, so it's probably a bug in the console showing an incorrect error.
     
  4. TheLUNARTICK

    TheLUNARTICK

    Joined:
    Feb 15, 2014
    Posts:
    10
    Were you every able to get this issue resolved? Since switching to Iron Source I have been trying to reconfigure my app but running into the same AD_ID issue with just a clean build.

    Thanks in advance for any insight.
     
  5. Limewood_

    Limewood_

    Joined:
    Jan 5, 2020
    Posts:
    62
    Unfortunately not, but I was able to ignore the error in Google Play and publish anyway and have had no problems with it there.
     
  6. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,058
    Are you sure you have no problem? Because I did the same thing but I have very bad impression rate like 25% or below. And I am not sure if it is related to this problem.
     
  7. FriedrichNietzsche

    FriedrichNietzsche

    Joined:
    Mar 18, 2023
    Posts:
    7
    I'm running into exactly the same issue using unity 2022, admob and google iap.
     
  8. mc_fragezeichen

    mc_fragezeichen

    Joined:
    Aug 17, 2020
    Posts:
    10
    I was forced (by google play console), to compile with android api 33 as target SDK. Then this error showed suddenly showed up (I'm using Unity 2022.2.6f1, Firebase Analytics SDK, Unity Analytics, my app is for children under 13 years, it does not have any advertisment)

    Any official solution from the unity developers to this problem? It's kind of urgent, as I cannot release updates to my app currently...
     
  9. Flawless83

    Flawless83

    Joined:
    Dec 7, 2016
    Posts:
    131
    Im in the same position, how do we include the com.google.android.gms.permission.AD_ID permission?
     
  10. dhindman

    dhindman

    Joined:
    Jan 28, 2016
    Posts:
    17
    Bump. I'm also working on a project intended for children and we have no need for the ad permission. We are using Firebase Analytics.

    This issue is blocking our Android release so any guidance would be greatly appreciated.
     
    kar-moviestarplanet and niktumis like this.
  11. dhindman

    dhindman

    Joined:
    Jan 28, 2016
    Posts:
    17
    I was able to remove the AD_ID permission using a custom manifest with the following elements inside the manifest element:

    <meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
    <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />


    Firebase Analytics is still functioning as expected, so I believe this has solved the issue for me. Your mileage may vary. I'm sure that this will cause problems in some cases.
     
  12. alexgarciaguilera

    alexgarciaguilera

    Joined:
    Feb 7, 2017
    Posts:
    1
    That works great!
    No more confusing errors in Google Play Console!
     
  13. pokelocos

    pokelocos

    Joined:
    Nov 9, 2015
    Posts:
    54
    Hello, I also have the error, could you publish your manifest files? to have them as a reference and understand what I'm doing wrong.
     
  14. CharSui

    CharSui

    Joined:
    Nov 19, 2021
    Posts:
    3

    It work! Thank you rescue me from googleplay
     
  15. Mohamed_Elmejrab

    Mohamed_Elmejrab

    Joined:
    Aug 10, 2018
    Posts:
    2
    I had the same problem but different cause, I'll explain what worked in my case.

    Background: In my case I was making a game with ads integrated, then we decided to remove them entirely so the package was removed from the Package Manager, the Ads service was disabled from the project settings, and then updated the App Content section on Google Play Console to state that we're not using ads.

    Problem: When pushing to production it gave an error that you are using Ads but not declaring so on App Content section, if I revert the changes on App Content, it gives the opposite error where the it says permission is not declared whereas I am saying we are using ads now, the error is suppressible if you wish to do so, it may solve it but that is not what we tried.

    Cause: In this case we had an Internal Testing track still live with Ads in it, suspecting it is the cause of the second error (Permission not declared, App Content says game has ads), that is what turned out to be true.

    Solution: I updated the Internal Test track with a new release that does not have the AD_ID permission, suppressed the error and published the update. Now when I went to create a new release back in Production track it did not throw an error, so the permission is not declared and the App Content states that we don't use ads, which is the correct state.

    Hope this helps if someone gets into the same case as ours.
     
  16. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,147
    I got this after adding Firebase & Google Analytics. Do they set the advertising ID flag and if so why?