title: WiFi broadcast receiver not delivering in Android 7.1.1
body: <p>Using Android-7.1.1, SDK-25.3.0</p>
  
  <p>I am having problems with the WiFi-broadcast-receiver. Until Android-7.0.x everything worked well. But now, having updated to Android-7.1.1. with its newest SDK, my WiFi-broadcast-receiver does not return any values anymore.</p>
  
  <p>The <code>List&lt;ScanResult&gt; resultList = wifi.getScanResults();</code> returns 0 (instead of like before some valuable values). Why is this ??? What could the Android-update have caused or is there any mistake in my code ?? Any help appreciated!</p>
  
  <p>Below is my code: </p>
  
  <p>Setting up the WiFi-broadcast-receiver inside the Fragment (not full fragment but excerts...):</p>
  
  <pre><code>public class ScanTeachingFragment extends Fragment implements MyWifiReceiver.OnWiFiResultListener {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
  
          // set up WiFi Manager
          this.wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
          if (wifiManager.isWifiEnabled()) {
              // register Broadcast-Receiver for WiFi
              receiverWifi = new MyWifiReceiver(this.context);
              IntentFilter filterWiFi = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
              getActivity().registerReceiver(receiverWifi, filterWiFi);
          }
          // setListener necessary otherwise null-pointer occurs in WiFiReceiver
          receiverWifi.setListener(this);
      }
  
      private void ScanWifi() {
  
          if (!IndoorNavHelpers.inEmulator()) {
              wifiManager.setWifiEnabled(true);
              wifiManager.startScan();
          }
      }
  }
  </code></pre>
  
  <p>Here is the WiFi-broadcast-receiver implementation:</p>
  
  <pre><code>package com.xxxx.yyyy.broadcast_receiver;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.net.wifi.ScanResult;
  import android.net.wifi.WifiManager;
  import java.util.List;
  
  public class MyWifiReceiver extends BroadcastReceiver {
  
      private Context context;
      OnWiFiResultListener resultListener;
  
      // ScanFragment must implement this interface
      public interface OnWiFiResultListener {
          void scanWiFireceived(List&lt;ScanResult&gt; resultList);
      }
      // create setListener class (otherwise null-pointer occurs)
      public void setListener(OnWiFiResultListener listener) {
          this.resultListener = listener;
      }
  
      public MyWifiReceiver(Context context)
      {
          this.context = context;
      }
      // This method call when number of wifi connections changed
      public void onReceive(final Context context, Intent intent) {
  
          WifiManager wifi = (WifiManager)this.context.getSystemService(Context.WIFI_SERVICE);
          List&lt;ScanResult&gt; resultList = wifi.getScanResults();
  
          // ???????????????????????????????????????????????????????????
          // Here resultList returns 0, WHY ????????????????????????????
          // ???????????????????????????????????????????????????????????
  
          // append newly found WiFi-scanResults to WiFiSniffing_File by calling callback-method in MainActivity
          if(resultListener != null) {
              resultListener.scanWiFireceived(resultList);
          }
      }
  }
  </code></pre>
  
  <p>Here is my gradle-file:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.2"
      defaultConfig {
          applicationId "com.xxxx.yyyy"
          minSdkVersion 25
          targetSdkVersion 25
          versionCode 1
          versionName "0.0.2(26)"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:25.3.0'
      compile 'com.android.support:support-v4:25.3.0'
      compile 'com.android.support:design:25.3.0'
      compile files('libs/ftp4j-1.7.2.jar')
      compile 'org.greenrobot:eventbus:3.0.0'
      compile 'com.github.johnkil.print:print:1.2.2'
      compile 'com.github.bmelnychuk:atv:1.2.+'
  }
  </code></pre>
  
  <p>Here is my manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.xxxx.yyyy"&gt;
  
      &lt;uses-permission android:name="android.permission.USE_FINGERPRINT" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  
      &lt;uses-permission android:name="android.permission.android.permission.WAKE_LOCK" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/yyyy_icon"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"
          android:largeHeap="true"&gt;
          &lt;activity
              android:name=".activity.MainActivity"
              android:launchMode="singleTop"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar"
              android:screenOrientation="portrait"
              android:excludeFromRecents="true"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /&gt;
                  &lt;action android:name="android.hardware.usb.action.USB_DEVICE_DETATCHED" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" /&gt;
              &lt;meta-data android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" android:resource="@xml/device_filter" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>