简体   繁体   English

我们如何将wifi扫描结果连接到特定的ssid网络并想要启动应用程序?

[英]How we can connect the wifi scan results to specific ssid network and want to launch app?

I have implemented code to get the wifi scan results & and tried to connect to particular specific networks which have good signal strength and after launching the app not able to open it. 我已经实现了获取wifi扫描结果的代码,并尝试连接到信号强度很好的特定特定网络,并且在启动应用后无法打开它。

Ref link: 参考链接:

WiFiActivity WiFi活动

Please provide your suggestions, any clue or lead would be a great help. 请提供您的建议,任何线索或线索都会有很大帮助。 Thanks in advance. 提前致谢。

Try this code, hope it'll work 试试这个代码,希望它能工作

WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = String.format("\"%s\"", ssid);
wifiConfig.preSharedKey = String.format("\"%s\"", key);

WifiManager wifiManager = (WifiManager)getSystemService(WIFI_SERVICE);
//remember id
int netId = wifiManager.addNetwork(wifiConfig);
wifiManager.disconnect();
wifiManager.enableNetwork(netId, true);
wifiManager.reconnect();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何连接到特定的wifi网络? - How can I connect to a specific wifi network? 以编程方式连接到wifi网络(首先访问ssid)? - Connect to wifi network programmatically(first access ssid)? 如何使用指定的SSID自动连接WiFi? - How to auto connect a WiFi with specified SSID? 如何通过单击配置的网络结果的ListView上的项目连接到WIFI网络? - How can I connect to a WIFI Network by clicking an item on ListView of configured network results.? 旧应用无法在android N上获得WiFi扫描结果 - Old app can't get WiFi scan results on android N 扫描可用的wifi,检测最强的Wifi SSID以启动XML活动布局 - Scanning available wifi, detect specific strongest Wifi SSID to launch an XML activity layout 如何将Android Wifi扫描结果放入列表? - How can I get Android Wifi Scan Results into a list? 如何从android的扫描结果中过滤特定的SSID? - How to filter a specific SSID from scan result in android? SSID与BSSID:通过Android以编程方式连接到Wifi /使用WifiManager连接到网络 - SSID vs BSSID: Connecting to Wifi via Android Programatically / Using WifiManager to connect to a network Android app 忽略 Raspberry PI Wifi AP。如何将 Android App 连接到非 inte.net Wifi.network? - Android app ignore Raspberry PI Wifi AP.How to connect Android App to non internet Wifi network?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM