A. android怎么开启wifi热点
需要的工具原料:Android手机
在Android手机中打开手机系统设置,进入”手机系统设置窗口”
5.设置完成
注意事项:建议在安全性选择WPA2 PSK
B. android怎么实现开机自动启动wifi热点
1.新建一个Receiver监听系统的BOOT_COMPLETE Broadcast,就可以实现开机的监听
2.启动WiFi热点。这个网上一大堆的代码,大体的思路就是:检测WiFI是否开启,如果开启了,那就不操作。如果没有开启,那就调用API开启它。
C. Android 代码设置Wifi 热点密码设置的问题
java">netConfig.allowedKeyManagement.set(4);
//WifiConfiguration.KeyMgmt.WPA2_PSK=4,但是不能直接拿到,所以参数直接设成4就行了
D. android怎么打开wifi
安卓如果想要打开WiFi的话,在手机设置当中,点击WiFi就能够打开WiFi。
E. Android开发如何使用代码配置手机wifi的pac地址
这里用到的手机型号为魅族M6120,其中的具体步骤如下:
1、打开手机的设置界面,需要选择无线网络这一项。
F. Android WiFi开发,如何自动连接的代码
public class WifiAutoConnectManager {
private static final String TAG = WifiAutoConnectManager.class.getSimpleName();
WifiManager wifiManager;
// 定义几种加密方式,一种是WEP,一种是WPA,还有没有密码的情况 public enum WifiCipherType { WIFICIPHER_WEP, WIFICIPHER_WPA, WIFICIPHER_NOPASS, WIFICIPHER_INVALID }
// 构造函数 public WifiAutoConnectManager(WifiManager wifiManager) { this.wifiManager = wifiManager; }
// 提供一个外部接口,传入要连接的无线网 public void connect(String ssid, String password, WifiCipherType type) { Thread thread = new Thread(new ConnectRunnable(ssid, password, type)); thread.start(); }
// 查看以前是否也配置过这个网络 private WifiConfiguration isExsits(String SSID) { List<WifiConfiguration> existingConfigs = wifiManager.getConfiguredNetworks(); for (WifiConfiguration existingConfig : existingConfigs) { if (existingConfig.SSID.equals("\"" + SSID + "\"")) { return existingConfig; } } return null; }
private WifiConfiguration createWifiInfo(String SSID, String Password, WifiCipherType Type) { WifiConfiguration config = new WifiConfiguration(); config.allowedAuthAlgorithms.clear(); config.allowedGroupCiphers.clear(); config.allowedKeyManagement.clear(); config.allowedPairwiseCiphers.clear(); config.allowedProtocols.clear(); config.SSID = "\"" + SSID + "\""; // nopass if (Type == WifiCipherType.WIFICIPHER_NOPASS) { config.wepKeys[0] = ""; config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); config.wepTxKeyIndex = 0; } // wep if (Type == WifiCipherType.WIFICIPHER_WEP) { if (!TextUtils.isEmpty(Password)) { if (isHexWepKey(Password)) { config.wepKeys[0] = Password; } else { config.wepKeys[0] = "\"" + Password + "\""; } } config.allowedAuthAlgorithms.set(AuthAlgorithm.OPEN); config.allowedAuthAlgorithms.set(AuthAlgorithm.SHARED); config.allowedKeyManagement.set(KeyMgmt.NONE); config.wepTxKeyIndex = 0; } // wpa if (Type == WifiCipherType.WIFICIPHER_WPA) { config.preSharedKey = "\"" + Password + "\""; config.hiddenSSID = true; config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); // 此处需要修改否则不能自动重联 // config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); config.status = WifiConfiguration.Status.ENABLED; } return config; }
// 打开wifi功能 private boolean openWifi() { boolean bRet = true; if (!wifiManager.isWifiEnabled()) { bRet = wifiManager.setWifiEnabled(true); } return bRet; }
class ConnectRunnable implements Runnable { private String ssid;
private String password;
private WifiCipherType type;
public ConnectRunnable(String ssid, String password, WifiCipherType type) { this.ssid = ssid; this.password = password; this.type = type; }
@Override public void run() { // 打开wifi openWifi(); // 开启wifi功能需要一段时间(我在手机上测试一般需要1-3秒左右),所以要等到wifi // 状态变成WIFI_STATE_ENABLED的时候才能执行下面的语句 while (wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLING) { try { // 为了避免程序一直while循环,让它睡个100毫秒检测…… Thread.sleep(100); } catch (InterruptedException ie) { } }
WifiConfiguration wifiConfig = createWifiInfo(ssid, password, type); // if (wifiConfig == null) { Log.d(TAG, "wifiConfig is null!"); return; }
WifiConfiguration tempConfig = isExsits(ssid);
if (tempConfig != null) { wifiManager.removeNetwork(tempConfig.networkId); }
int netID = wifiManager.addNetwork(wifiConfig); boolean enabled = wifiManager.enableNetwork(netID, true); Log.d(TAG, "enableNetwork status enable=" + enabled); boolean connected = wifiManager.reconnect(); Log.d(TAG, "enableNetwork connected=" + connected); } }
private static boolean isHexWepKey(String wepKey) { final int len = wepKey.length();
// WEP-40, WEP-104, and some vendors using 256-bit WEP (WEP-232?) if (len != 10 && len != 26 && len != 58) { return false; }
return isHex(wepKey); }
private static boolean isHex(String key) { for (int i = key.length() - 1; i >= 0; i--) { final char c = key.charAt(i); if (!(c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f')) { return false; } }
return true; }}
G. android 怎么启动wifi热点
安卓手机启动WiFi热点的方法(以360 N4S手机为例):
①进入到手机系统设置里面,点击【个人热点】;
H. android开发中如果我想代码实现打开wifi热点如何实现
1·申请权限:
android.permission.ACCESS_WIFI_STATE
android.permission.CHANGE_WIFI_STATE
android.permission.WAKE_LOCK
2·获取WifiManager
wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
3·开启、关闭wifi
if (wifiManager.isWifiEnabled()) {
wifiManager.setWifiEnabled(false);
} else {
wifiManager.setWifiEnabled(true);
}
4·注意
如果遇到force-close, 选wait即可, 因为启动wifi需要几秒钟, UI如果5妙钟还没反映的话, 系统会给你这个force close exception
PS:我以前做过设计读取系统硬件信息的时候用过,但是很长时间没用了,这段注释是从网上来的,希望能帮到你。
I. android adb shell 中怎么开启wifi 热点
前提是有安装wpa supplicant ,步骤如下:
adb shell
svc wifi enable 打开无线网络服务 用ps|grep wifi 查看wpa_supplicant是不是已经起来了。
wpa_cli
scan 扫描无线网络
scan_results 按信号顺序显示扫描到的无线网络
list_networks
select_network [network id] 选择网络
enable_network [network id]
password 配置网络的密码
ping 应该会成功
netcfg 查看本机的网络参数
df 查看手机空间
解决方法如下:
adb shell
su
然后
第一步:加载驱动
insmod /lib/moles/dhd.ko "firmware_path=/system/etc/wifi/bcmdhd_apsta.bin nvram_path=/system/etc/wifi/nvram_net.txt iface_name=wlan0"
第二步:
netcfg wlan0 up
第三步:
ndc softap startap
以上方法虽然可以打开,但是firmware_path=/system/etc/wifi/bcmdhd_apsta.bin是无法找到的,并且
firmware_path=/system/etc/wifi/bcmdhd_apsta.bin_b2这个文件是无法打开softap的