我正在尝试按照基本的Android Wifi教程在我的应用程序中启用wifi功能,但是当我尝试执行它时 - 无法建立wifi连接。
我完全按照SO教程/示例,没有错误或eclipse中的问题,我启动应用程序......然后噗:没有任何反应。
P.S。
我的logcat中有一些有趣的活动 - 我感觉它可以解释为什么我无法连接。
指南/示例来源:
How do I connect to a specific Wi-Fi network in Android programmatically?
来源:
import java.util.List;
import android.app.Activity;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.util.Log;
import android.content.Context;
public class Connect extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.connect);
String networkSSID = "ANDRE-PC_NETWORK";
String networkPass = "<password-ommited>";
WifiConfiguration conf = new WifiConfiguration();
conf.SSID = "\"" + networkSSID + "\""; //ssid must be in quotes
conf.wepKeys[0] = "\"" + networkSSID + "\""; ;
conf.wepTxKeyIndex = 0;
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
conf.preSharedKey = "\""+ networkPass +"\"";
conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
WifiManager wifiManager = (WifiManager)getSystemService(WIFI_SERVICE);
wifiManager.addNetwork(conf);
List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
for( WifiConfiguration i : list ) {
if(i.SSID != null && i.SSID.equals("\"" + networkSSID + "\"")) {
wifiManager.disconnect();
wifiManager.enableNetwork(i.networkId, true);
wifiManager.reconnect();
break;
}
}
}}
如果你在我的logcat中看到任何有趣的东西 - 请告诉我!
我甚至不知道从哪里开始...
HEX中的LOGCAT w键:
04-04 10:47:29.712: W/SignalStrength(675): getCdmaLevel =4
04-04 10:47:29.712: W/SignalStrength(675): getEvdoLevel =4
04-04 10:47:29.712: W/SignalStrength(675): getLevel=4 (SignalStrength: 99 0 -76 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4401)
04-04 10:47:29.712: W/SignalStrength(852): getCdmaLevel =4
04-04 10:47:29.712: W/SignalStrength(852): getEvdoLevel =4
04-04 10:47:29.712: W/SignalStrength(852): getLevel=4 (SignalStrength: 99 0 -76 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4401)
04-04 10:47:29.712: W/SignalStrength(852): getCdmaLevel =4
04-04 10:47:29.712: W/SignalStrength(852): getEvdoLevel =4
04-04 10:47:29.712: W/SignalStrength(852): getLevel=4 (SignalStrength: 99 0 -76 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4401)
04-04 10:47:29.712: D/STATUSBAR-NetworkController(852): onSignalStrengthsChanged signalStrength=SignalStrength: 99 0 -76 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4401 level=4
04-04 10:47:29.712: W/AlarmManager(675): FACTORY_ON= 0
04-04 10:47:29.722: W/SignalStrength(675): getDbm=-76
04-04 10:47:29.722: W/SignalStrength(675): getCdmaAsuLevel=8
04-04 10:47:29.722: W/SignalStrength(675): getEvdoAsuLevel=2
04-04 10:47:29.722: W/SignalStrength(675): getAsuLevel=2
04-04 10:47:31.313: W/PowerManagerService(675): Timer 0x7->0x3|0x0
04-04 10:47:31.313: I/PowerManagerService(675): Ulight 0x7->0x3|0x0
04-04 10:47:31.313: D/LightsService(675): setLightLocked is called
04-04 10:47:31.624: E/SMD(187): DCD ON
04-04 10:47:31.644: D/PowerManagerService(675): lightSensorChangedLocked value=73 immediate=false
04-04 10:47:31.644: D/PowerManagerService(675): getAutoBrightnessValue : in bound ( 45 < 73 <= 1372 )
04-04 10:47:31.644: D/PowerManagerService(675): getAutoBrightnessValue : in bound ( 45 < 73 <= 1372 )
04-04 10:47:31.644: D/PowerManagerService(675): lcdValue 130
04-04 10:47:31.644: D/PowerManagerService(675): buttonValue 130
04-04 10:47:31.644: D/PowerManagerService(675): keyboardValue 0
04-04 10:47:31.644: D/PowerManagerService(675): lightSensorChangedLocked : mKeyboardLight : 0
04-04 10:47:32.254: W/SignalStrength(675): getCdmaLevel =5
04-04 10:47:32.254: W/SignalStrength(675): getEvdoLevel =4
04-04 10:47:32.254: W/SignalStrength(675): getLevel=4 (SignalStrength: 99 0 -69 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4501)
04-04 10:47:32.254: W/SignalStrength(852): getCdmaLevel =5
04-04 10:47:32.254: W/SignalStrength(852): getEvdoLevel =4
04-04 10:47:32.254: W/SignalStrength(852): getLevel=4 (SignalStrength: 99 0 -69 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4501)
04-04 10:47:32.254: W/SignalStrength(852): getCdmaLevel =5
04-04 10:47:32.254: W/SignalStrength(852): getEvdoLevel =4
04-04 10:47:32.254: W/SignalStrength(852): getLevel=4 (SignalStrength: 99 0 -69 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4501)
04-04 10:47:32.254: D/STATUSBAR-NetworkController(852): onSignalStrengthsChanged signalStrength=SignalStrength: 99 0 -69 -25 -92 -25 5 99 2147483647 2147483647 2147483647 2147483647 cdma 0x4501 level=4
04-04 10:47:32.264: W/SignalStrength(675): getDbm=-69
04-04 10:47:32.264: W/SignalStrength(675): getCdmaAsuLevel=16
04-04 10:47:32.264: W/SignalStrength(675): getEvdoAsuLevel=2
04-04 10:47:32.264: W/SignalStrength(675): getAsuLevel=2
04-04 10:47:32.264: W/AlarmManager(675): FACTORY_ON= 0
04-04 10:47:33.055: I/wpa_supplicant(1553): Scan requested (ret=0) - scan timeout 30 seconds
04-04 10:47:34.427: E/MP-Decision(1542): UP Ld:88 Nw:1.990000 Tw:140 rq:1.500000 seq:147.000000
04-04 10:47:34.437: D/dalvikvm(29031): GC_CONCURRENT freed 103K, 87% free 565K/4096K, paused 1ms+0ms, total 4ms
04-04 10:47:34.617: E/SMD(187): DCD ON
04-04 10:47:34.757: E/MP-Decision(1542): DOWN Ld:29 Ns:1.100000 Ts:190 rq:1.000000 seq:195.000000
04-04 10:47:35.147: D/PowerManagerService(675): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT frequency : 1026000 uid : 1000 pid : 675 tag : ActivityManager
04-04 10:47:35.147: W/ActivityManager(675): mDVFSLock.acquire()
04-04 10:47:35.167: D/Launcher.HomeFragment(1074): onPause
04-04 10:47:35.167: D/widget(1074): [MSC_HERO_Accu_JB]>>> WC:1232 [0:0] fireOP
04-04 10:47:35.167: D/Launcher(1074): onPause, Launcher: 1105102976
04-04 10:47:35.167: D/widget(1074): [MSC_HERO_Accu_JB]>>> WC:1037 [0:0] onPause
04-04 10:47:35.167: V/WindowManager(675): rotationForOrientationLw(orient=-1, last=0); user=0 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false sensorRotation=-1
04-04 10:47:35.187: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.197: D/dalvikvm(29049): GC_CONCURRENT freed 104K, 86% free 588K/4096K, paused 0ms+1ms, total 3ms
04-04 10:47:35.197: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.217: D/Launcher(1074): onTrimMemory. Level: 20
04-04 10:47:35.237: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.247: I/Adreno200-EGLSUB(192): <CreateImage:897>: Android Image
04-04 10:47:35.247: I/Adreno200-EGLSUB(192): <GetImageAttributes:1162>: RGBX_8888
04-04 10:47:35.257: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.257: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.268: I/Adreno200-EGLSUB(192): <CreateImage:897>: Android Image
04-04 10:47:35.268: I/Adreno200-EGLSUB(192): <GetImageAttributes:1106>: RGBA_8888
04-04 10:47:35.268: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.298: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.358: E/MP-Decision(1542): UP Ld:98 Nw:1.990000 Tw:140 rq:1.500000 seq:188.000000
04-04 10:47:35.358: E/wpa_supplicant(1553): Line 0: Too long WEP key 0 '"73:75:70:65:72:6d:61:6e"'.
04-04 10:47:35.358: E/WifiConfigStore(675): failed to set wep_key0: "73:75:70:65:72:6d:61:6e"
04-04 10:47:35.358: E/WifiConfigStore(675): Failed to set a network variable, removed network: 10
04-04 10:47:35.388: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.388: D/STATUSBAR-StatusBarManagerService(675): setSystemUiVisibility(0x0)
04-04 10:47:35.388: D/STATUSBAR-StatusBarManagerService(675): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
04-04 10:47:35.408: I/ClipboardServiceEx(675): Send intent for dismiss clipboard dialog inside hideCurrentInputLocked() !
04-04 10:47:35.458: E/Sensors(675): accelHandler 2.301614 0.295785 9.055569
04-04 10:47:35.458: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.458: I/Adreno200-EGLSUB(192): <CreateImage:897>: Android Image
04-04 10:47:35.458: I/Adreno200-EGLSUB(192): <GetImageAttributes:1162>: RGBX_8888
04-04 10:47:35.468: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.468: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.598: D/PowerManagerService(675): releaseDVFSLockLocked : all DVFS_MIN_LIMIT are released
04-04 10:47:35.598: D/Launcher.HomeFragment(1074): onStop
04-04 10:47:35.598: D/Launcher(1074): onStop, Launcher: 1105102976
04-04 10:47:35.598: W/ActivityManager(675): mDVFSLock.release()
04-04 10:47:35.608: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.658: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.668: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.668: D/KeyguardViewMediator(675): setHidden false
04-04 10:47:35.928: E/MP-Decision(1542): DOWN Ld:19 Ns:1.100000 Ts:190 rq:0.000000 seq:217.000000
04-04 10:47:36.379: I/wpa_supplicant(1553): nl80211: Received scan results (3 BSSes)
04-04 10:47:36.379: I/wpa_supplicant(1553): wlan0: CTRL-EVENT-NO-CONNECTION
04-04 10:47:36.379: I/wpa_supplicant(1553): wpa_supplicant_req_new_scan: wpa_s->global->bStopPeriodicScan : 0, timeout_sec : 8
04-04 10:47:36.379: D/Tethering(675): interfaceLinkStateChanged wlan0, true
04-04 10:47:36.379: D/Tethering(675): interfaceStatusChanged wlan0, true
04-04 10:47:36.389: W/AlarmManager(675): FACTORY_ON= 0
04-04 10:47:36.399: W/AlarmManager(675): FACTORY_ON= 0
04-04 10:47:37.620: E/SMD(187): DCD ON
04-04 10:47:39.122: I/rmt_storage(128): rmt_storage_rw_iovec_cb: /boot/modem_fs2: clnt_h=0x2: req_h=0x6ae msg_id=3: R/W request received
04-04 10:47:39.122: I/rmt_storage(128): wakelock acquired: 1, error no: 110
04-04 10:47:39.122: I/rmt_storage(128): rmt_storage_client_thread: /boot/modem_fs2: clnt_h=0x2 Unblock worker thread (th_id: 1103109840)
04-04 10:47:39.122: D/QMI_FW(128): QCSI: QMI_CSI_RX: cntl_flag - 00, txn_id - 0356, msg_id - 0003, msg_len - 002b
04-04 10:47:39.222: D/QMI_FW(128): QCSI: xport_handle_event[16]
04-04 10:47:39.302: I/rmt_storage(128): rmt_storage_client_thread: /boot/modem_fs2: clnt_h=0x2: req_h=0x6ae msg_id=3: Bytes written = 3145216
04-04 10:47:39.302: I/rmt_storage(128): rmt_storage_client_thread: /boot/modem_fs2: clnt_h=0x2: req_h=0x6ae msg_id=3: Bytes written = 512
04-04 10:47:39.302: I/rmt_storage(128): rmt_storage_client_thread: /boot/modem_fs2: clnt_h=0x2: req_h=0x6ae msg_id=3: Send response: res=0 err=0
04-04 10:47:39.302: I/rmt_storage(128): rmt_storage_client_thread: /boot/modem_fs2: clnt_h=0x2 About to block rmt_storage client thread (th_id: 1103109840) wakelock released: 1, error no: 0
04-04 10:47:39.302: D/QMI_FW(128): QCSI: QMI_CSI_TX: cntl_flag - 02, txn_id - 0356, msg_id - 0003, msg_len - 0007
04-04 10:47:39.302: D/QMI_FW(128): QCSI: Sent[16]: 14 bytes to port 1280
04-04 10:47:39.452: D/PowerManagerService(675): lightSensorChangedLocked value=69 immediate=false
04-04 10:47:39.452: D/PowerManagerService(675): getAutoBrightnessValue : in bound ( 45 < 69 <= 1372 )
04-04 10:47:39.452: D/PowerManagerService(675): getAutoBrightnessValue : in bound ( 45 < 69 <= 1372 )
04-04 10:47:39.452: D/PowerManagerService(675): lcdValue 130
04-04 10:47:39.452: D/PowerManagerService(675): buttonValue 130
04-04 10:47:39.452: D/PowerManagerService(675): keyboardValue 0
04-04 10:47:39.452: D/PowerManagerService(675): lightSensorChangedLocked : mKeyboardLight : 0
04-04 10:47:39.762: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 10:47:40.623: E/SMD(187): DCD ON
LOGCAT:HEX中没有键
04-04 11:27:25.210: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:25.240: E/SMD(187): DCD ON
04-04 11:27:26.741: I/wpa_supplicant(1553): State: DISCONNECTED -> SCANNING
04-04 11:27:26.741: I/wpa_supplicant(1553): CTRL-EVENT-STATE-CHANGE id=10 state=3 BSSID=00.00.00
04-04 11:27:26.741: I/wpa_supplicant(1553): 414E4452452D50435F4E4554574F524B
04-04 11:27:26.781: I/wpa_supplicant(1553): Scan requested (ret=0) - scan timeout 30 seconds
04-04 11:27:27.182: D/ActivityThread(31678): setTargetHeapUtilization:0.25
04-04 11:27:27.182: D/ActivityThread(31678): setTargetHeapIdealFree:8388608
04-04 11:27:27.182: D/ActivityThread(31678): setTargetHeapConcurrentStart:2097152
04-04 11:27:27.202: I/ActivityThread(31678): Pub com.wssyncmldm.ContentProvider: com.wssyncmldm.db.sql.XDMDbContentProvider
04-04 11:27:27.212: I/DBG_DM(31678): [][Line:67][onCreate]
04-04 11:27:27.232: I/DBG_DM(31678): [v5_1209_3_1][Line:686][xdmGetCheckWifiOnlyModel] isWifiOnly : false
04-04 11:27:27.232: I/DBG_DM(31678): [v5_1209_3_1][Line:701][xdmGetCheckDataOnly] Voice : true
04-04 11:27:27.242: I/DBG_DM(31678): [v5_1209_3_1][Line:702][xdmGetCheckDataOnly] SMS : true
04-04 11:27:27.242: I/DBG_DM(31678): [v5_1209_3_1][Line:709][xdmGetCheckDataOnly] isDataOnly : false
04-04 11:27:27.242: D/dalvikvm(675): WAIT_FOR_CONCURRENT_GC blocked 0ms
04-04 11:27:27.422: D/dalvikvm(675): GC_EXPLICIT freed 58K, 28% free 38507K/53191K, paused 7ms+16ms, total 179ms
04-04 11:27:27.422: I/DBG_DM(31678): [v5_1209_3_1][Line:52][onCreate] DMApplication Start !
04-04 11:27:27.432: I/DBG_DM(31678): [v5_1209_3_1][Line:1779][xdmGetRootingPrefValue] 0
04-04 11:27:27.432: I/DBG_DM(31678): [v5_1209_3_1][Line:86][xdmGetRootingFeature] Default : false
04-04 11:27:27.432: I/DBG_DM(31678): [v5_1209_3_1][Line:172][xdmAgentTaskHandler] XEVENT_OS_INITIALIZED
04-04 11:27:27.442: I/DBG_DM(31678): [v5_1209_3_1][Line:148][xdmAgentSetSyncMode] nSync = 0
04-04 11:27:27.452: I/DBG_DM(31678): [v5_1209_3_1][Line:546][xdmGetEnableLiveDemoFromCSCFeature] enable LiveDemo : false
04-04 11:27:27.462: I/DBG_DM(31678): [v5_1209_3_1][Line:1860][xdbDMffs_Init] xdbDMffs_Init
04-04 11:27:27.472: I/DBG_DM(31678): [v5_1209_3_1][Line:372][xdmInitExternalStorageState]
04-04 11:27:27.482: I/DBG_DM(31678): [v5_1209_3_1][Line:427][xdmInitExternalStorageState] bExternalStorageAvailable [true]
04-04 11:27:27.482: I/DBG_DM(31678): [v5_1209_3_1][Line:428][xdmInitExternalStorageState] bExternalSDStorageAvailable [false]
04-04 11:27:27.502: I/DBG_DM(31678): [v5_1209_3_1][Line:182][xdmAgentTaskHandler] XEVENT_PHONEBOOK_INITIALIZED
04-04 11:27:27.522: I/DBG_DM(31678): [v5_1209_3_1][Line:1084][onCallStateChanged] >>>>>>>>>>> onCallStateChanged
04-04 11:27:27.522: I/DBG_DM(31678): [v5_1209_3_1][Line:1104][onCallStateChanged] >>>>>>>>>>> CALL_STATE_IDLE
04-04 11:27:27.532: I/DBG_DM(31678): [v5_1209_3_1][Line:1591][xdmProtoIsWIFIConnected] WiFi DisConnected
04-04 11:27:27.532: I/DBG_DM(31678): [v5_1209_3_1][Line:1591][xdmProtoIsWIFIConnected] WiFi DisConnected
04-04 11:27:28.023: E/Watchdog(675): !@Sync 1425
04-04 11:27:28.243: E/SMD(187): DCD ON
04-04 11:27:28.403: D/dalvikvm(31695): GC_CONCURRENT freed 103K, 87% free 565K/4096K, paused 0ms+1ms, total 5ms
04-04 11:27:29.264: D/PowerManagerService(675): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT frequency : 1026000 uid : 1000 pid : 675 tag : ActivityManager
04-04 11:27:29.264: W/ActivityManager(675): mDVFSLock.acquire()
04-04 11:27:29.274: D/dalvikvm(31708): GC_CONCURRENT freed 104K, 86% free 589K/4096K, paused 0ms+0ms, total 4ms
04-04 11:27:29.745: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:30.105: I/wpa_supplicant(1553): nl80211: Received scan results (4 BSSes)
04-04 11:27:30.105: I/wpa_supplicant(1553): wlan0: CTRL-EVENT-NO-CONNECTION
04-04 11:27:30.105: I/wpa_supplicant(1553): wpa_supplicant_req_new_scan: wpa_s->global->bStopPeriodicScan : 0, timeout_sec : 8
04-04 11:27:30.105: W/AlarmManager(675): FACTORY_ON= 0
04-04 11:27:30.115: D/Tethering(675): interfaceLinkStateChanged wlan0, true
04-04 11:27:30.115: D/Tethering(675): interfaceStatusChanged wlan0, true
04-04 11:27:30.115: W/AlarmManager(675): FACTORY_ON= 0
04-04 11:27:30.265: D/PowerManagerService(675): releaseDVFSLockLocked : all DVFS_MIN_LIMIT are released
04-04 11:27:30.265: W/ActivityManager(675): mDVFSLock.release()
04-04 11:27:30.856: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:31.246: E/SMD(187): DCD ON
04-04 11:27:34.249: E/SMD(187): DCD ON
04-04 11:27:34.530: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:35.651: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:37.153: D/dalvikvm(193): WAIT_FOR_CONCURRENT_GC blocked 0ms
04-04 11:27:37.223: D/ActivityThread(31724): setTargetHeapUtilization:0.25
04-04 11:27:37.223: D/ActivityThread(31724): setTargetHeapIdealFree:8388608
04-04 11:27:37.223: D/ActivityThread(31724): setTargetHeapConcurrentStart:2097152
04-04 11:27:37.233: D/dalvikvm(193): GC_EXPLICIT freed 38K, 43% free 12111K/20995K, paused 4ms+43ms, total 74ms
04-04 11:27:37.233: D/dalvikvm(193): WAIT_FOR_CONCURRENT_GC blocked 0ms
04-04 11:27:37.243: E/SMD(187): DCD ON
04-04 11:27:37.293: D/dalvikvm(193): GC_EXPLICIT freed <1K, 43% free 12111K/20995K, paused 5ms+3ms, total 59ms
04-04 11:27:37.293: I/nmc-java(31724): loadLibrary >>> java.library.path=/vendor/lib:/system/lib
04-04 11:27:37.293: I/nmc-java(31724): loadLibrary >>> data directory=/data
04-04 11:27:37.293: I/nmc-java(31724): loadLibrary >>> packageName=com.nuance.nmc.sihome.metropcs
04-04 11:27:37.293: I/nmc-java(31724): loadLibrary >>> Loading '/data/data/com.nuance.nmc.sihome.metropcs/lib/libnmc.so' ...
04-04 11:27:37.293: E/nmc-java(31724): loadLibrary >>> Unsatisfied link error: Cannot load library: load_library[1093]: Library '/data/data/com.nuance.nmc.sihome.metropcs/lib/libnmc.so' not found
04-04 11:27:37.293: I/nmc-java(31724): loadLibrary >>> Loading '/system/lib/libnmc.so' ...
04-04 11:27:37.303: D/dalvikvm(193): WAIT_FOR_CONCURRENT_GC blocked 0ms
04-04 11:27:37.333: D/dalvikvm(193): GC_EXPLICIT freed <1K, 43% free 12111K/20995K, paused 2ms+3ms, total 32ms
04-04 11:27:38.154: I/wpa_supplicant(1553): Scan requested (ret=0) - scan timeout 30 seconds
04-04 11:27:39.455: V/AlarmManager(675): waitForAlarm result :4
04-04 11:27:39.455: V/AlarmManager(675): trigger ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP
04-04 11:27:40.016: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:40.246: E/SMD(187): DCD ON
04-04 11:27:40.536: I/DBG_DM(31678): [v5_1209_3_1][Line:434][xdmInitAdpWaitBearerSetting] waits 13 sec
04-04 11:27:40.536: I/DBG_DM(31678): [v5_1209_3_1][Line:3343][xdbGetFUMOStatus] xdbGetFUMOStatus : 0
04-04 11:27:40.546: I/DBG_DM(31678): [v5_1209_3_1][Line:1759][xdmGetUpdateReport] wssGetUpdateReport : 0
04-04 11:27:40.546: I/DBG_DM(31678): [v5_1209_3_1][Line:207][xdmAgentTaskHandler] XEVENT_DM_INIT
04-04 11:27:40.566: I/SysScopeVerifier(31678): SHA1-Digest :hI/erQ2i2NX0ldg3pB2Zct4P4i8=
04-04 11:27:40.566: I/SysScopeVerifier(31678): SHA1-Digest :MqtHJr/par3LL1huEuNvd7lYic0=
04-04 11:27:40.606: I/SysScopeVerifier(31678): classes.dexMqtHJr/par3LL1huEuNvd7lYic0=
04-04 11:27:40.616: I/SysScopeVerifier(31678): lib/armeabi/libcordon.sohI/erQ2i2NX0ldg3pB2Zct4P4i8=
04-04 11:27:40.626: E/DBG_DM(31678): Warning!!! [v5_1209_3_1][Line:1818][xdmCheckSystemRooting] Device is ok
04-04 11:27:40.626: I/DBG_DM(31678): [v5_1209_3_1][Line:442][xdmInitAdpWaitSystemRootingCheck] Check completed.
04-04 11:27:40.626: I/DBG_DM(31678): [v5_1209_3_1][Line:1591][xdmProtoIsWIFIConnected] WiFi DisConnected
04-04 11:27:40.626: I/DBG_DM(31678): [v5_1209_3_1][Line:54][xdmInitAdpGetNetStatus] SIM : Network unknown
04-04 11:27:40.626: E/DBG_DM(31678): Warning!!! [v5_1209_3_1][Line:214][xdmAgentTaskHandler] Network Status is not ready. DM Not Initialized
04-04 11:27:40.636: I/DBG_DM(31678): [v5_1209_3_1][Line:983][xdmGetTopActivityName] TopActivity : com.nfc.linked.Connect
04-04 11:27:40.636: I/DBG_DM(31678): [v5_1209_3_1][Line:207][xdmAgentTaskHandler] XEVENT_DM_INIT
04-04 11:27:40.646: I/SysScopeVerifier(31678): SHA1-Digest :hI/erQ2i2NX0ldg3pB2Zct4P4i8=
04-04 11:27:40.646: I/SysScopeVerifier(31678): SHA1-Digest :MqtHJr/par3LL1huEuNvd7lYic0=
04-04 11:27:40.666: I/SysScopeVerifier(31678): classes.dexMqtHJr/par3LL1huEuNvd7lYic0=
04-04 11:27:40.676: I/SysScopeVerifier(31678): lib/armeabi/libcordon.sohI/erQ2i2NX0ldg3pB2Zct4P4i8=
04-04 11:27:40.676: E/DBG_DM(31678): Warning!!! [v5_1209_3_1][Line:1818][xdmCheckSystemRooting] Device is ok
04-04 11:27:40.676: I/DBG_DM(31678): [v5_1209_3_1][Line:442][xdmInitAdpWaitSystemRootingCheck] Check completed.
04-04 11:27:40.686: I/DBG_DM(31678): [v5_1209_3_1][Line:1591][xdmProtoIsWIFIConnected] WiFi DisConnected
04-04 11:27:40.686: I/DBG_DM(31678): [v5_1209_3_1][Line:54][xdmInitAdpGetNetStatus] SIM : Network unknown
04-04 11:27:40.686: E/DBG_DM(31678): Warning!!! [v5_1209_3_1][Line:214][xdmAgentTaskHandler] Network Status is not ready. DM Not Initialized
04-04 11:27:40.686: I/DBG_DM(31678): [v5_1209_3_1][Line:983][xdmGetTopActivityName] TopActivity : com.nfc.linked.Connect
04-04 11:27:40.856: V/AT_Distributor(200): received[idx : 0, fd : 11] : UART, 1
04-04 11:27:41.477: I/wpa_supplicant(1553): nl80211: Received scan results (3 BSSes)
04-04 11:27:41.477: I/wpa_supplicant(1553): wlan0: CTRL-EVENT-NO-CONNECTION
04-04 11:27:41.477: I/wpa_supplicant(1553): wpa_supplicant_req_new_scan: wpa_s->global->bStopPeriodicScan : 0, timeout_sec : 8
04-04 11:27:41.477: D/Tethering(675): interfaceLinkStateChanged wlan0, true
04-04 11:27:41.477: D/Tethering(675): interfaceStatusChanged wlan0, true
04-04 11:27:41.497: W/AlarmManager(675): FACTORY_ON= 0
04-04 11:27:41.497: W/AlarmManager(675): FACTORY_ON= 0
04-04 11:27:43.249: E/SMD(187): DCD ON
权限:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
答案 0 :(得分:2)
更改
conf.wepKeys[0] = "\"" + networkSSID + "\"";
到
conf.wepKeys[0] = "\"" + networkPass + "\"";
答案 1 :(得分:0)
当您设置这样的Wi-Fi连接并且logcat没有显示任何错误,调试信息或任何类型的信息时,通常意味着您输入的预共享密钥与网络密钥不匹配。 而且我认为这是因为这一行:
conf.preSharedKey = "\"+ networkPass +\"";
应该是:
conf.preSharedKey = "\""+ networkPass +"\"";