code: @SuppressLint("MissingPermission") @RequiresPermission(allOf = {
        ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, ACCESS_WIFI_STATE
    }) public static Observable<List<ScanResult>> observeWifiAccessPoints(final Context context) {
      @SuppressLint("WifiManagerPotentialLeak") final WifiManager wifiManager =
          (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
  
      if (wifiManager != null) {
        wifiManager.startScan(); // without starting scan, we may never receive any scan results
      } else {
        Log.w(LOG_TAG, "WifiManager was null, so WiFi scan was not started");
      }
  
      final IntentFilter filter = new IntentFilter();
      filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
      filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
  
      return Observable.create(new ObservableOnSubscribe<List<ScanResult>>() {
  
        @Override public void subscribe(final ObservableEmitter<List<ScanResult>> emitter)
            throws Exception {
          final BroadcastReceiver receiver = createWifiScanResultsReceiver(emitter, wifiManager);
  
          if (wifiManager != null) {
            context.registerReceiver(receiver, filter);
          } else {
            emitter.onError(new RuntimeException(
                "WifiManager was null, so BroadcastReceiver for Wifi scan results "
                    + "cannot be registered"));
          }
  
          Disposable disposable = disposeInUiThread(new Action() {
            @Override public void run() {
              tryToUnregisterReceiver(context, receiver);
            }
          });
  
          emitter.setDisposable(disposable);
        }
      });
    }
docs: Observes WiFi Access Points.
  Returns fresh list of Access Points
  whenever WiFi signal strength changes.
  
  @param context Context of the activity or an application
  @return RxJava Observable with list of WiFi scan results