0

我正处于开发应用程序的开始阶段,该应用程序需要每秒扫描 wifi AP。扫描部分在一位 HTC 英雄上运行良好,但是,我的银河选项卡需要 6 秒才能完成一次扫描。我写了一个非常简单的程序,连续扫描wifi并记下一次扫描需要多长时间。(从 wifi.startScan() 到接收器获取结果)。在 HTC 手机中是 500 毫秒,但在三星标签中,平均需要 6 秒。我想知道是否有人可以帮助我解决这个问题。是三星换了操作系统还是硬件问题?

程序如下:

import java.util.Date;
import java.util.List;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class wifiScan extends Activity {

    private class WifiReceiver extends BroadcastReceiver{
      @Override
      public void onReceive(Context c, Intent intent) {
        List<ScanResult> results = wifi.getScanResults();
        Date tempDate=new Date();
        String info=testNumber+" "+(tempDate.getTime()-testDate.getTime())+" "+results.size();
        Log.i("wifiScan", info);    
        wifiText.setText(info);
        testNumber++;
        testDate=new Date();
        wifi.startScan();

        }
    }
    private TextView wifiText;
    private WifiManager wifi;
    private WifiReceiver receiver;
    private Date testDate;
    private static int testNumber=0;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        testNumber=0;

        wifiText = (TextView) findViewById(R.id.wifiText);
        receiver=new WifiReceiver();
        registerReceiver(receiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
        wifi =(WifiManager)getSystemService(Context.WIFI_SERVICE);
        if(!wifi.isWifiEnabled()){
            wifi.setWifiEnabled(true); 
        }
        startScan();
    }
    @Override
    public void onStop(){
        super.onStop();
        finish();
    }
    public void startScan(){
        testDate=new Date();
        wifi.startScan();
    }
}

日志信息如下:

02-16 15:42:22.600: WARN/PowerManagerService(2484): Timer 0x1->0x0|0x1
02-16 15:42:22.600: ERROR/PowerManagerService(2484): CurLock p:3 mPS:1
02-16 15:42:22.600: WARN/PowerManagerService(2484): type=SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim' active (minState=1) activeT=1257228
02-16 15:42:22.607: WARN/PowerManagerService(2484): type=PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial' active (minState=0) activeT=1257228
02-16 15:42:24.005: DEBUG/dalvikvm(3374): GC_EXPLICIT freed 790 objects / 55536 bytes in 143ms
02-16 15:42:24.775: DEBUG/AndroidRuntime(4056): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-16 15:42:24.775: DEBUG/AndroidRuntime(4056): CheckJNI is OFF
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): setted country_code = SINGAPORE
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): setted sales_code = XSP
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): found sales_code tag = <XSP>, </XSP> 
02-16 15:42:24.792: DEBUG/dalvikvm(4056): creating instr width table
02-16 15:42:24.822: DEBUG/AndroidRuntime(4056): --- registering native functions ---
02-16 15:42:24.904: DEBUG/LibQmg_native(4056): register_android_app_LibQmg
02-16 15:42:24.986: DEBUG/AndroidRuntime(4056): Shutting down VM
02-16 15:42:24.986: DEBUG/dalvikvm(4056): Debugger has detached; object registry had 1 entries
02-16 15:42:24.993: INFO/AndroidRuntime(4056): NOTE: attach of thread 'Binder Thread #2' failed
02-16 15:42:25.169: DEBUG/AndroidRuntime(4064): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-16 15:42:25.169: DEBUG/AndroidRuntime(4064): CheckJNI is OFF
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): setted country_code = SINGAPORE
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): setted sales_code = XSP
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): found sales_code tag = <XSP>, </XSP> 
02-16 15:42:25.184: DEBUG/dalvikvm(4064): creating instr width table
02-16 15:42:25.212: DEBUG/AndroidRuntime(4064): --- registering native functions ---
02-16 15:42:25.286: DEBUG/LibQmg_native(4064): register_android_app_LibQmg
02-16 15:42:25.368: INFO/ActivityManager(2484): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=nus.master.test/.wifiScan }
02-16 15:42:25.376: INFO/Launcher(3211): onPause()
02-16 15:42:25.411: DEBUG/AndroidRuntime(4064): Shutting down VM
02-16 15:42:25.411: DEBUG/dalvikvm(4064): Debugger has detached; object registry had 1 entries
02-16 15:42:25.419: INFO/AndroidRuntime(4064): NOTE: attach of thread 'Binder Thread #2' failed
02-16 15:42:25.450: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:25.450: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:25.454: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:25.454: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:25.454: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:25.611: INFO/Launcher(3211): onWindowFocusChanged(false)
02-16 15:42:30.724: DEBUG/dalvikvm(3200): GC_EXPLICIT freed 4001 objects / 233800 bytes in 118ms
02-16 15:42:30.892: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:30.892: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:30.892: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:30.896: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:30.947: INFO/wpa_supplicant(3810): SAN_RESULTS : [34] 
02-16 15:42:30.958: INFO/wpa_supplicant(3810): SAN_RESULTS : [34] 
02-16 15:42:30.970: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:30.970: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:30.970: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:31.009: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:31.021: ERROR/WifiManager(2935): showApDialog
02-16 15:42:31.025: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:31.029: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:31.060: INFO/wifiScan(4009): 0 5609 21
02-16 15:42:31.064: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:31.064: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:31.068: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:31.068: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:31.068: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:36.536: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:36.536: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:36.536: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:36.540: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:36.587: INFO/wpa_supplicant(3810): SAN_RESULTS : [35] 
02-16 15:42:36.611: INFO/wpa_supplicant(3810): SAN_RESULTS : [35] 
02-16 15:42:36.634: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:36.634: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:36.661: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:36.665: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:36.665: ERROR/WifiManager(2935): showApDialog
02-16 15:42:36.669: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:36.669: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:36.724: INFO/wifiScan(4009): 1 5662 22
02-16 15:42:36.728: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:36.728: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:36.732: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:36.732: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:36.736: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:41.247: DEBUG/BatteryService(2484): update start
02-16 15:42:41.275: DEBUG/BatteryService(2484): updateBattery level:83 scale:100 status:4 health:2 present:true voltage: 4051 temperature: 330 technology: Li-ion AC powered:false USB powered:true icon:17302421
02-16 15:42:41.314: DEBUG/CorePlayerService(3270): mSystemReceiver:onReceive(action=android.intent.action.BATTERY_CHANGED) is called
02-16 15:42:41.357: DEBUG/WifiService(2484): ACTION_BATTERY_CHANGED pluggedType: 2
02-16 15:42:42.177: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:42.177: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:42.181: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:42.181: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:42.185: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:42.189: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:42.193: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:42.216: INFO/wpa_supplicant(3810): SAN_RESULTS : [36] 
02-16 15:42:42.240: INFO/wpa_supplicant(3810): SAN_RESULTS : [36] 
02-16 15:42:42.240: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:42.240: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:42.247: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:42.271: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:42.271: ERROR/WifiManager(2935): showApDialog
02-16 15:42:42.275: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:42.282: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:42.314: INFO/wifiScan(4009): 2 5588 21
02-16 15:42:42.322: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:42.322: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:42.326: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:42.329: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:42.329: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:43.255: DEBUG/BatteryService(2484): update start
02-16 15:42:43.294: DEBUG/BatteryService(2484): updateBattery level:83 scale:100 status:4 health:2 present:true voltage: 4080 temperature: 320 technology: Li-ion AC powered:false USB powered:true icon:17302421
02-16 15:42:43.384: DEBUG/WifiService(2484): ACTION_BATTERY_CHANGED pluggedType: 2
02-16 15:42:43.388: DEBUG/CorePlayerService(3270): mSystemReceiver:onReceive(action=android.intent.action.BATTERY_CHANGED) is called
02-16 15:42:47.783: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:47.786: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:47.786: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:47.786: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:47.798: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:47.798: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:47.814: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:47.826: INFO/wpa_supplicant(3810): SAN_RESULTS : [38] 
02-16 15:42:47.853: INFO/wpa_supplicant(3810): SAN_RESULTS : [38] 
02-16 15:42:47.872: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:47.872: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:47.904: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:47.919: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:47.923: ERROR/WifiManager(2935): showApDialog
02-16 15:42:47.927: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:47.931: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:47.970: INFO/wifiScan(4009): 3 5652 26
02-16 15:42:47.974: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:47.974: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:47.986: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:47.986: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:47.986: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:53.423: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:53.427: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:53.427: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:53.427: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:53.435: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:53.439: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:53.439: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:53.462: INFO/wpa_supplicant(3810): SAN_RESULTS : [37] 
02-16 15:42:53.482: INFO/wpa_supplicant(3810): SAN_RESULTS : [37] 
02-16 15:42:53.493: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:53.497: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:53.525: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:53.529: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:53.529: ERROR/WifiManager(2935): showApDialog
02-16 15:42:53.532: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:53.532: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:53.575: INFO/wifiScan(4009): 4 5602 24
02-16 15:42:53.579: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:53.579: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:53.591: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:53.591: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:53.595: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:59.040: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:59.040: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE 
02-16 15:42:59.044: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:59.048: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:59.048: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:59.056: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:59.075: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:59.091: INFO/wpa_supplicant(3810): SAN_RESULTS : [38] 
02-16 15:42:59.115: INFO/wpa_supplicant(3810): SAN_RESULTS : [38] 
02-16 15:42:59.122: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:59.122: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:59.138: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:59.142: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:59.154: ERROR/WifiManager(2935): showApDialog
02-16 15:42:59.158: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:59.161: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:59.204: INFO/wifiScan(4009): 5 5626 22
02-16 15:42:59.204: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:59.204: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:59.208: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:59.208: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:59.208: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:43:00.025: VERBOSE/AlarmManager(2484): set: Alarm{47dfb360 type 1 android}
4

2 回答 2

1

我猜你看到的是被动扫描和主动扫描之间的区别。如果您被动扫描,则必须在每个通道上保持至少 100 毫秒(实际上可能接近 200 毫秒),而主动扫描则可以更快地扫描。大概 6s 扫描是被动的,而 500ms 扫描是主动的。

在监管域中,除非它能够确定允许哪些通道,否则不允许设备进行传输,因此它必须被动扫描,直到获得所需的信息。之后,它应该能够切换到主动扫描。

于 2011-02-17T13:28:37.730 回答
0

如果要主动扫描,可以调用 wifi.startScanActive()。

于 2011-05-13T06:10:04.403 回答