Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to implement Google Play ADVERTISING ID PERMISSION, in C# code in Unity 2020 editor?

Discussion in 'Unity Ads & User Acquisition' started by avepardo, Apr 5, 2022.

  1. avepardo


    Nov 3, 2020
    Message of Warning of Google Play Console

    Last July we announced changes to the Advertising Policy to help strengthen security and privacy. When users choose to remove their advertising ID, developers will receive a string of zeros instead of the identifier if they try to access it. This behavior will be expanded to phones, tablets, and Android TV starting April 1, 2022.

    We also announced that you have to declare an AD_ID permission when upgrading your app to target API level 31 (Android 12). We recently announced that we will be giving developers more time to ease the transition. We'll ask for this permission statement when your apps can target Android 13, instead of starting with Android 12.

    If you're using an advertising ID, when your app targets Android 13 or higher, you'll need to declare the AD_ID permission. Apps that don't declare the permission will get a string of zeros.

    Your kind help, Google Play Store, when uploading a game type application made in Unity version 2020, asks me to declare a "publication ID permission", the same one that I was investigating for hours on how to implement it in the game ; They tell me in the documentation I will find that a line of code must be declared in the "Manifest.xml" in which the "AD_ID" permission is shown, however, since it is a "C#" code that is programmed, and that later Unity compiles it on the intended platform, which in my case turns out to be for "Android" mobile devices, it performs said transformation automatically, which makes it difficult for me to find an intermediate step to add said line of code in the "Manifest.xml".

    Line of Code to be Implemented in the Manifest.xml

    <uses-permission android:name=""/>
    I found this documentation in the following link:

    In this address they tell me that if you have a Unity Ads SDK version 4.1 or higher, skip that step, otherwise if it is lower than 4.0.1, it must be done manually.

    Kind help, if anyone knows how to implement it in "C#" code, in the Unity editor, as I assume I have a lower version of the Unity Ads SDK.

    Thank you very much Greetings.