1

My client just got an e-mail from Google Play, saying that once his app starts targeting Android 13 (which hasn't happened yet), we need to use the AD_ID permission. And it's an easy one-line addition to AndroidManifest.xml. Problem is, the app has several configurations and one one uses ads and hence needs AD_ID. Is there a simple way to use permissions only for some flavors (like free but not premium)?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
AppLover
  • 149
  • 9
  • 1
    "the app has several configurations" -- what specifically do you mean by "configurations" in this context? Do you mean that you only show ads in landscape or something? – CommonsWare Aug 22 '22 at 16:47
  • 1
    Sorry I made a mistake. I was looking at the wrong keyword, but the app has 2 flavors - free and premium - and I only need that permission in the free version. In the Premium it isn’t needed because that one doesn’t use ads – AppLover Aug 23 '22 at 19:16

1 Answers1

2

You can have an AndroidManifest.xml file in a source set for your free flavor (e.g., app/src/free/AndroidManifest.xml for an app module). In there, have your <uses-permission> element in the proper spot as a child of <manifest>, but otherwise leave it empty. That will get merged in with your main manifest for free builds and will not be included in your premium builds.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491