Search code examples
androidandroid-studiopermissionsgoogle-play

Why does my App need android.permission.FOREGROUND_SERVICE_LOCATION?


I have been working on various features on our Android 14 App using the latest version of Android Studio Hedgehog and Java over the past months. Whenever I completed a big feature, I published the App using Google's Play Console.

Today, I wasn't able to do so, because apparently my App uses android.permission.FOREGROUND_SERVICE_LOCATION and because of that I need to adjust our Manifest file to show where we use this permission and I need to declare via video in Google's Play Console where we use it and why we need it.

My problem: I do not know where we use it...

  • If I search for the text FOREGROUND_SERVICE_LOCATION I do not find anything.
  • If I search for functions that are associated with this permission such as startForeground or stopForeground (see here), I have zero hits.
  • I also checked for the word permission throughout the entire application and found nothing that was unexpected or had foreground in its name.
  • We have no object that extends a Service or a Worker.

I do use quite a lot of hardware components on the devices (camera, location, Bluetooth, NFC, Barcode Scanner, ...), but only when the App is running and not in the background.

But when I upload the latest Bundle into Google's Play Console, I get the following list of permissions the App apparently requests. Many of them I do in fact declare in our Manifest, but I have no idea where the foreground services are coming from. Therefore, I do not know how to declare my Manifest properly.

  1. android.permission.ACCESS_COARSE_LOCATION
  2. android.permission.ACCESS_FINE_LOCATION
  3. android.permission.ACCESS_MEDIA_LOCATION
  4. android.permission.ACCESS_NETWORK_STATE
  5. android.permission.ACCESS_WIFI_STATE
  6. android.permission.BLUETOOTH
  7. android.permission.BLUETOOTH_ADMIN
  8. android.permission.BLUETOOTH_SCAN
  9. android.permission.CAMERA
  10. android.permission.FOREGROUND_SERVICE_LOCATION
  11. android.permission.INTERNET
  12. android.permission.NFC
  13. android.permission.POST_NOTIFICATIONS
  14. android.permission.READ_EXTERNAL_STORAGE
  15. android.permission.READ_PHONE_STATE
  16. android.permission.RECEIVE_BOOT_COMPLETED
  17. android.permission.WAKE_LOCK
  18. android.permission.WRITE_EXTERNAL_STORAGE
  19. com.google.android.c2dm.permission.RECEIVE
  20. com.symbol.emdk.permission.EMDK

I am grateful for any support.


Solution

  • Check the merged manifest, the permission is probably coming from a library you used.

    You can see it directly on Android studio https://developer.android.com/build/manage-manifests#inspect_the_merged_manifest_and_find_conflicts