StartScan()不起作用

时间:2013-08-06 10:49:37

标签: android wifi wifimanager

我想对接入点进行一些扫描,但方法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();,原因是什么?谢谢!

0 个答案:

没有答案