0

我想对接入点进行一些扫描,但该方法wifiManager.startScan()在我的代码中不起作用:

    @Override
    public void onClick(View v) {

        switch(v.getId()) {
        case R.id.buttonMeasure:

       wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
       registerReceiver(broadcastReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
    wifiManager.setWifiEnabled(true); //Edit
       timer2 = new Timer(WifiActivity.this);

       while(broadcastReceiver.getMeasureFinished()<=49){
           Log.d("info7","mesure" + broadcastReceiver.getMeasureFinished());
           success = false;
            while(success==false){
            success=wifiManager.startScan();
                Log.d("info2","startScan : " + success);
            }
       }


        case R.id.buttonLocate:
            //localization.
        }
   }

Eclipse很好进入循环,但不想阅读wifiManager.startScan();,是什么原因?谢谢!

4

0 回答 0