android-wifi

How to get available wifi networks and display them in a list in android

我与影子孤独终老i 提交于 2019-11-26 05:33:25
问题 Friends, I want to find all available WiFi networks and display them in a list I have tried as below. But it\'s not working. I have edited my code, and now I got the result but with all the result that I don\'t need. I only need names of wifi network in my list. public class MainActivity extends Activity { TextView mainText; WifiManager mainWifi; WifiReceiver receiverWifi; List<ScanResult> wifiList; StringBuilder sb = new StringBuilder(); @Override protected void onCreate(Bundle

android: Determine security type of wifi networks in range (without connecting to them)

非 Y 不嫁゛ 提交于 2019-11-26 04:45:55
问题 I can enumerate all wifi networks in range (using startScan + SCAN_RESULTS_AVAILABLE_ACTION + getScanResults) and get their SSID and BSSID values, but I can\'t figure out how to determine the security type of each network. In my main object: IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); registerReceiver(scanReceiver, intentFilter); ((WifiManager)getSystemService(Context.WIFI_SERVICE)).startScan(); In my scanReceiver object:

Wifi Connect-Disconnect Listener

 ̄綄美尐妖づ 提交于 2019-11-26 03:51:43
问题 Which listener does my class have to implement inorder to automatically check code if the wifi connects/disconnects? I\'m able to manually check for wifi connection/disconnection but each time I need to connect/disconnect WIFI from android settings and then run my program for the result. My current code is as simple as: WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE); if (wifi.isWifiEnabled()==true) { tv.setText(\"You are connected\"); } else { tv.setText(\"You are NOT

SCAN_RESULTS_AVAILABLE_ACTION return empty list in Android 6.0

穿精又带淫゛_ 提交于 2019-11-26 03:38:04
问题 Yesterday my Nexus 5 receive the update from Android MNC to version 6.0 - Marshmallow . Since then, the action to scan the networks available in the device stop receiving the list, in this case the result list have a size of 0, even with 10+ Wifi networks listed in the Wifi system settings. The code for this is the usual: Register the SCAN_RESULTS_AVAILABLE_ACTION and wait for the event in the Receiver, like this: // Register the Receiver in some part os fragment... getActivity()

SCAN_RESULTS_AVAILABLE_ACTION return empty list in Android 6.0

╄→гoц情女王★ 提交于 2019-11-26 03:11:34
问题 Yesterday my Nexus 5 receive the update from Android MNC to version 6.0 - Marshmallow . Since then, the action to scan the networks available in the device stop receiving the list, in this case the result list have a size of 0, even with 10+ Wifi networks listed in the Wifi system settings. The code for this is the usual: Register the SCAN_RESULTS_AVAILABLE_ACTION and wait for the event in the Receiver, like this: // Register the Receiver in some part os fragment... getActivity()

How to programmatically create and read WEP/EAP WiFi configurations in Android?

。_饼干妹妹 提交于 2019-11-26 01:46:08
问题 How to programmatically create and read WEP/EAP WiFi configurations in Android? I have seen a number of people struggling on this very question on various forums and all across the community. I know this is not that straight forward(especially EAP) to figure out because When I wanted to achieve the same I too struggled quite a lot.Well, all the hard work of code analysis and searching various implementations on the internet done with I was finally able to achieve the goal. All the credit goes

How to detect when WIFI Connection has been established in Android?

扶醉桌前 提交于 2019-11-26 01:22:21
问题 I need to detect when I have network connectivity over WIFI. What broadcast is sent to establish that a valid network connection has been made. I need to validate that a valid network connection for HTTP exists. What should I listen for and what additional tests do I need to make to know that a valid connection exists. 回答1: You can register a BroadcastReceiver to be notified when a WiFi connection is established (or if the connection changed). Register the BroadcastReceiver : IntentFilter

How do I see if Wi-Fi is connected on Android?

ぐ巨炮叔叔 提交于 2019-11-26 01:22:03
问题 I don\'t want my user to even try downloading something unless they have Wi-Fi connected. However, I can only seem to be able to tell if Wi-Fi is enabled, but they could still have a 3G connection. android.net.wifi.WifiManager m = (WifiManager) getSystemService(WIFI_SERVICE); android.net.wifi.SupplicantState s = m.getConnectionInfo().getSupplicantState(); NetworkInfo.DetailedState state = WifiInfo.getDetailedStateOf(s); if (state != NetworkInfo.DetailedState.CONNECTED) { return false; }

Broadcast receiver for checking internet connection in android app

我是研究僧i 提交于 2019-11-25 22:20:56
问题 I am developing an android broadcast receiver for checking internet connection. The problem is that my broadcast receiver is being called two times. I want it to get called only when the network is available. If it is unavailable, I don\'t want notified. This is the broadcast receiver public class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { final ConnectivityManager connMgr = (ConnectivityManager) context

How do I connect to a specific Wi-Fi network in Android programmatically?

风格不统一 提交于 2019-11-25 21:48:33
问题 I want to design an app which shows a list of Wi-Fi networks available and connect to whichever network is selected by the user. I have implemented the part showing the scan results. Now I want to connect to a particular network selected by the user from the list of scan results. How do I do this? 回答1: You need to create WifiConfiguration instance like this: String networkSSID = "test"; String networkPass = "pass"; WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" +