开发者

Android Wifi scanning too slow

开发者 https://www.devze.com 2023-02-11 06:13 出处:网络
I am at the beginning stage on developing an application, which needs scan the wifi APs per second. The scanning part works well on one HTC hero, however, it takes 6 seconds for my galaxy tab to finis

I am at the beginning stage on developing an application, which needs scan the wifi APs per second. The scanning part works well on one HTC hero, however, it takes 6 seconds for my galaxy tab to finish one scan. I write a very simple program, scanning wifi continuously and note down how long it takes for one scan. (from wifi.startScan() to receiver get result开发者_如何学Pythons). In HTC phone, it's 500 ms, but in Samsung tab, it takes 6s on average. I wonder if anyone can help me to solve this problem. Is it because Samsung changed the os or because the hardware's problem?

the program is as follows:

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();
    }
}

The log info is as follows:

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}


I would guess that what you see is the difference between passive and active scan. If you scan passively you have to stay at least 100ms on each channel (probably closer to 200ms in practice) while with an active scan you can scan a lot quicker. Presumably the 6s scan is passive while the 500ms scan is active.

With regulatory domain the device is not allowed to transmit unless it can figure out which channels are allowed so it must scan passively until it gets the information it needs. After that it should be able to switch to active scanning.


If you want active scan, you can call wifi.startScanActive().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号