Search code examples
androidgpsandroid-6.0-marshmallowibeacon-androidaltbeacon

Why Android Marshmallow requires GPS to find iBeacons.?


I developed an app that work with iBeacons and this week i update it to work on Marshmallow. Until the update it didn't require GPS, but after the update it says that to find beacons in background it need gps. i don't find any reference on it. does someone know why Android Marshmallow requires GPS to find iBeacons? I use altBeacon library to locate the beacons.

edit: I'll clarify the question. Is the GPS involved in finding Beacons. Except for the permissions.


Solution

  • No, it is not necessary to have GPS turned on or even have a device with a GPS radio to detect beacons in Android 6. The GPS radio, if present is not activated when scanning for Bluetooth beacons.

    The confusion comes from the fact that Android 6 newly requires apps to obtain either ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions to be allowed to perform bluetooth scans. This change is simply motivated by informing users that bluetooth scanning can be used to infer their location (like with beacons). But the need to get this permission does not mean there is any technical dependency on the GPS radio. Consider that Android also can use WiFi access points and cell towers to infer location.

    On some devices, notably the Nexus 5, there have been reports that disabling Location Services (Settings -> Location -> Off) disables the ability to scan for bluetooth devices. It is unclear whether this is a bug in that Nexus 5 build image or a new security restriction by Android that will be followed on other models in the future. See here for more info. Regardless, having the GPS radio on is not a requirement for Location Services being enabled.

    Full disclosure: I am the lead developer on the Android Beacon Library open source project.