Performing network scan requiring permission for coarse location
<p>I am working on an app which does a network scan and puts all the found SSIDs into a spinner. </p>

<p>Android Studio warns that you need permission for <code>CHANGE_WIFI_STATE</code>. Upon adding this into the manifest, Android Studio doesn't give any warning by the <code>WifiManager.getScanResults()</code> returns 0 networks. I've found that I need to add/request permission for <code>ACCESS_COARSE_LOCATION</code>. </p>

<p>All I need is the network SSID, I don't care where the user is located, so why do I/the user need to allow the location permission just to get a list of available networks. Below is how I am currently doing the scan:</p>

<pre><code>    activity.registerReceiver(mWifiScannerReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
            wifiManager = (WifiManager)activity.getSystemService(Context.WIFI_SERVICE);

            wifiManager.startScan();

And my receiver:

if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION))
            {
                List&lt;ScanResult&gt; scanResults = wifiManager.getScanResults();
                wifiNetworkList.clear();
                //List&lt;String&gt; ssids = new ArrayList&lt;&gt;();
                for (int i = 0; i &lt; scanResults.size(); i++)
                {
                    wifiNetworkList.add(scanResults.get(i).SSID);
                    //ssids.add(scanResults.get(i).SSID);
                }
                //wifiNetworkList = ssids;
                wifiAdapter.notifyDataSetChanged();
            }
</code></pre>