Search code examples
androidpermissionsgoogle-nearby

Why Google Nearby Connections needs ACCESS_COARSE_LOCATION and/or ACCESS_FINE_LOCATION permissions?


I googled very hard and still no explanations "why?" these permissions are needed to establish offline(no internet) connection between devices. I have simple app that requires only p2p-star strategy to exchange data between devices in master-slave pattern and I have troubles explaining to my users why my app needs them. "Just because lib said so. That's why".

Official documentation also said nothing to me.

"A primary goal of this API is to provide a platform that is simple, reliable, and performant. Under the hood, the API uses a combination of Bluetooth, BLE, and Wifi hotspots, leveraging the strengths of each while circumventing their respective weaknesses. This effectively abstracts the vagaries of Bluetooth and Wifi across a range of Android OS versions and hardware, allowing developers to focus on the features that matter to their users."

PS: as I know ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION are about GPS

PSS: in case this question will be answered here https://github.com/android/connectivity-samples/issues/204


Solution

  • Because Bluetooth and WiFi scans can reveal the user's location, either as an approximation ("Family Room TV" was discovered, so you must be home) or in detail (Device A, B, and C were last seen at lat/lng X, so we think you're probably at X).

    https://developer.android.com/guide/topics/connectivity/bluetooth-le#permissions