code: @RequiresPermission(ACCESS_WIFI_STATE) public static Observable<Integer> observeWifiSignalLevel(
        final Context context, final int numLevels) {
      final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
      final IntentFilter filter = new IntentFilter();
      filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
  
      return Observable.create(new ObservableOnSubscribe<Integer>() {
        @Override public void subscribe(final ObservableEmitter<Integer> emitter) throws Exception {
          final BroadcastReceiver receiver =
              createSignalLevelReceiver(emitter, wifiManager, numLevels);
  
          if (wifiManager != null) {
            context.registerReceiver(receiver, filter);
          } else {
            emitter.onError(new RuntimeException(
                "WifiManager is null, so BroadcastReceiver for Wifi signal level "
                    + "cannot be registered"));
          }
  
          Disposable disposable = disposeInUiThread(new Action() {
            @Override public void run() {
              tryToUnregisterReceiver(context, receiver);
            }
          });
  
          emitter.setDisposable(disposable);
        }
      }).defaultIfEmpty(0);
    }
docs: Observes WiFi signal level.
  Returns WiFi signal level as an integer
  
  @param context Context of the activity or an application
  @param numLevels The number of levels to consider in the calculated level as Integer
  @return RxJava Observable with WiFi signal level