title: How reject call when phone is connected to a particular wifi network.?
body: <p>My code is given below.Please help me. its not working.The wifi thing is running succusfully but its not working when the method <code>callCut();</code>is called</p>
  
  <pre><code>       public class WifiReciever extends BroadcastReceiver {
          `` String state;
  
           @Override
              public void onReceive(Context context, Intent intent) {
           state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
        NetworkInfo info = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
              if (info != null &amp;&amp; info.isConnected()) {
  
                  WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
                  WifiInfo wifiInfo = wifiManager.getConnectionInfo();
                  bssid1 = wifiInfo.getIpAddress();
                 Toast.makeText(context, ""+bssid1, Toast.LENGTH_SHORT).show();
  
              }
  if (bssid1==67217600)
           {
              Toast.makeText(context, "connected to"+bssid1, Toast.LENGTH_SHORT).show();
  
               callCut();
  
  
           }
          else
        {
            Toast.makeText(context, "different netwrk "+bssid1, Toast.LENGTH_SHORT).show();
        }
  
  
      }
    private void callCut()
      {
          if (state.equals(TelephonyManager.EXTRA_STATE_RINGING))
          {
            //call reject
          }
          else
          {
              //normal
          }
          }
          }
  </code></pre>