WiFi getScanResults returns an empty list if GPS is off. (Android 6.0.1)

I tried to explain the problem in this gif

enter image description here

Basically, this test application gets the intent β€œRSSI_CHANGED” and displays the scan results on the screen.

Scan results are always empty, unless GPS is turned on.

I think my question is why?


To access the hardware IDs of neighboring external devices via Bluetooth and Wi-Fi scanning, your application must now have ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions

I have "ACCESS_COARSE_LOCATION"

+5
source share
2 answers

You must declare ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION . Permission is required because Bluetooth can be used to collect information about the user's location.

This information may come from the user's own devices.

So, you must specify permission on GPS devices for Bluetooth .

0
source

Google, Apple, Microsoft, etc. Create, maintain, and sell Wi-Fi router databases and their locations. By requiring the inclusion of a location function when scanning nearby WiFi networks, they receive and update this data.

0
source

Source: https://habr.com/ru/post/1242859/


All Articles