Expo 44 using expo-segment-analytics. Is advertising ID handled automatically?

  1. SDK Version: 44
  2. Platforms(Android/iOS/web/all): Android

I’m seeing the same message in the Google Play Console as described here: You must complete the advertising ID declaration before releasing an app that targets Android 13

You must complete the advertising ID declaration before releasing an app that targets Android 13
The advertising ID declaration form is now available for you to complete.

We’ll use this declaration to provide safeguards in Play Console. You will not be able to create releases targeting Android 13 until you complete the declaration.

Apps using advertising ID that target API level 33 (Android 13) or later must declare the normal permission com.google.android.gms.permission.AD_ID in their AndroidManifest.xml. This will prevent your advertising identifier from zeroing out. If you do not declare the permission in your manifest file, or if you use an SDK that omits the permission from their library manifest, this may impact your advertising and analytics use cases.

Unlike the user in that question, I’m on Expo 44 and using expo-analytics-segment. Because of that (and only because of that - i.e. I’m not using advertising otherwise), I have to answer Yes to the Advertising ID question in the Google Play Console (as mentioned here: When using `expo-analytics-segment`, should I say my Android app uses an Advertising ID? - #4 by amanhimself)

Before answering Yes, can someone confirm for me if I need to take some extra steps, mainly do I have to provide this Advertising ID myself because of the expo-analytics-segment package? Or does the package and Expo somehow handle it automatically?

@amanhimself Apologies for the ping but I remember you answering me last time so I’m hoping you might be able to shed light on this. Do you know if I have to provide this advertising ID myself or if it’s handled by the expo-analytics-segment package? If I have to provide it, I have no idea where I can get it and where I should put it in my code.

Is it asking you to provide an advertising ID? I’m not sure but let me get back to you on this.

It’s not asking me to provide the Advertising ID within the Google Play Console, but it’s saying that I “must declare the com.google.android.gms.permission.AD_ID permission in the app manifest”.

In the screenshot below, you can see the only thing that needs doing within the Play Console (answering Yes to the question and saying it’s just for Analytics) - but my question is about this com.google.android.gms.permission.AD_ID, Google says I need to declare it and I’m not sure if I need to do that myself (and how that’s done in an Expo managed app) or if this is handled automatically by Expo or expo-analytics-segment.

I want to make sure I know what happens after I submit the answer like in the screenshot to make sure app submissions aren’t blocked (like the description in the screenshot suggests).

@amanhimself

Maybe I was misunderstanding things a bit - this “Advertising ID” stuff is new to me and I thought the description in the Google Play console was saying that I need to provide the ID itself, but it seems that what needs declaring is rather a permission to denote that my app uses Advertising ID.

But my question still stands - do I have to declare this permission myself in my android app manifest (which I think I can do via @expo/config-plugins using withAndroidManifest) or is this already declared in the expo-analytics-segment library manifest? The description in the screenshot above mentions that some libraries do that.

EDIT:

Or perhaps I just need to change app.config.json like so:

{
  ...
  "expo": {
    "android": {
      "permissions": ["com.google.android.gms.permission.AD_ID"],
    },
    ...
  }
}

?

Apolgies for the late reply.

I think you’ll have to create a config plugin for this using withAndroidManifest since the AD_ID permission doesn’t seem to be listed in the list of available permissions in Android manifest here: Manifest.permission  |  Android Developers

Makes sense, thanks for confirming!

1 Like

Hey @jorundur,

Just talked to the team and their feedback on this was that you could also add "permissions": ["com.google.android.gms.permission.AD_ID"] directly in the app.json file since creating a config plugin and adding the permission via manifest will do the same thing.

You can also test it by adding the adding the "permissions" array in the app.json file and then run the Expo prebuild command (npx expo run:android). This command compiles the native code inside the android/ directory. Open the AndroidManifest.xml and you will see the com.google.android.gms.permission.AD_ID added.

Apologies for the earlier suggestion.

1 Like

No prob, thanks for the suggestion!

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.