title: How to get notified when a Open wifi network is available
body: <p>I have an app in which whenever users is in range of a particular Wifi. I want to give a notification to the user he is in the wifi zone and can connect to this wifi and start the app. This wifi is an open wifi.</p>
  
  <p>I tried using broadcast receiver with statically registering in AndroidManifest.xml. </p>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;receiver android:name=".WifiReceiver" android:enabled="true" android:exported="true"&gt;
    &lt;intent-filter android:priority="100"&gt;
      &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt;
      &lt;action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" /&gt;
      &lt;action android:name="android.net.wifi.WIFI_STATE_CHANGED" /&gt;
    &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>WifiReceiver:</p>
  
  <pre><code>if (_wifiManager == null)
              _wifiManager = (WifiManager)context.GetSystemService(Context.WifiService);
          if (_wifiManager.IsWifiEnabled)
          {
              var results = _wifiManager.ScanResults;
              if (results.Any(x =&gt; x.Ssid == "MyWifiName"))
              {
                  NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                      .SetSmallIcon(Resource.Drawable.ic_launcher_rounded)
                      .SetContentText("Your are in wifi zone. Start the app")
                      .SetContentTitle("My App");
  
                  NotificationManager notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
                  notificationManager.Notify(1,mBuilder.Build());
              }
          }
  </code></pre>
  
  <p>Now this works only when either I change the currently connected network or if the wifi state is changed i.e it is turned on or off.</p>
  
  <p>Precisely I want to detect if a new wifi (Open) network becomes available I want to check its name and if it is my wifi I want to show the notification.</p>
  
  <p>I am not inclined in using a service that would be my last resort using an alarm</p>
  
  <p>EDIT: how does android show the notification for open wifi networks are available. The ideal case for me to search if wifi is available is whenever android notifies this.</p>