wifimanager

Always getting -1 in adding new wifiConfiguration to the wifiiManager

六眼飞鱼酱① 提交于 2019-12-05 17:42:35
I am creating a list of in-range wifis and show it to the user. I want to the user can select each of the items in the list and insert the password in order to connect to the selected SSID. I wrote this method for wifi connection: private WifiConfiguration wifiConf; /* WifiConfiguration object */ private WifiManager wifiMgr; /* WifiManager object */ private WifiInfo wifiInfo; /* WifiInfo object */ public boolean connectToSelectedNetwork(String networkSSID, String networkPassword, String securityType) { int networkId; int SecurityProtocol; if (securityType.contains("WEP")) { SecurityProtocol =

Can I use WiFi to transfer data/messages between two android phones, not connected to a router?

倖福魔咒の 提交于 2019-12-05 17:19:07
I'm aware that if two Android phones are connected to a same wifi network, they can implement socket programming to transfer data between them But I actually want to know if you can use wifi as a transfer medium between two Android phones, just like you Bluetooth? With Android 2.2+ it is possible to create a WiFi hot-spot on one device so another device can connect. Internet connection on either device is not required. mpontillo What you are looking for is ad-hoc wireless networking , which is not well supported on the Android platform. (but some people have bravely rooted their phones and

how to programmatically determine if android is connected to wifi?

元气小坏坏 提交于 2019-12-05 13:38:00
I'm trying to setup a test for automation on a new android app that I'm developing but having a bit of trouble with one of the apis The problem i'm facing is I want to start the test AFTER wifi has a connection, not when its in the connecting state. I have tried two solutions but had no luck and test seems to start before my android device is fully connected (no x on the wifi bars) wifiManager.setWifiEnabled(state); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); while (wifiInfo.getSSID() == null) { Log.i("WifiStatus", "Here I am"); Thread.sleep(Time.ONE_SECOND); wifiInfo = wifiManager

Android WifiManager getScanResult complains Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission although declared permission

早过忘川 提交于 2019-12-05 09:51:25
I am developing an App to check Wifi points. I am getting error "java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results" at wifiManager.getScanResults() even though I already declared those permissions. main activity public class MainActivity extends AppCompatActivity { WifiManager wifiManager; String[] wifis; WifiReceiver wifiReceiver; ListView wifiListView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); wifiListView = (ListView) findViewById(R

Is it possible to add a network configuration on Android Q?

我只是一个虾纸丫 提交于 2019-12-05 07:34:22
Background I've noticed that in WifiManager class there is a function called addNetwork , that might be useful if I want to restore or save networks information (network name AKA SSID, together with the password and the type), so that I could also connect to it. The problem I can't find much information about how to do such a thing. I've seen various examples on StackOverflow, and if I target Android API 28 (or below), I indeed succeed to make it add a network and even connect to it. When targeting Android 29 (Android Q), however, it fails to add the network. What I've found Since I'm trying

Android 6 : Connect to specific wifi network programmatically not working

不打扰是莪最后的温柔 提交于 2019-12-05 03:24:33
问题 I am trying to connect to a wifi network by giving the SSID and pass using WifiManager configurations. Based on this threads solution: How do I connect to a specific Wi-Fi network in Android programmatically? The reconnect method is called. but nothing happens (not connected). Is the Android version (6.0.1) for something? If yes then how to perform a network connection programmatically on Android 6? 回答1: A few things have changed about how you connect to a WiFi network since android

No response received in startscan method at WifiManager in Android 8 Oreo

旧时模样 提交于 2019-12-05 01:30:18
问题 According to official Android documentation, the method startScan at WifiManager is deprecated in API level P. However I am trying to use this method in API level 26 (previous to P) without success. I have developped an app which requires the scanning of the WiFi networks, if the user agree with the required permissions, and this behaviour is paramount for the appropriate functioning of the app. However I do not receive any response when calling the startScan method. ¿Can anyone help me to

Android wifimanager always returns true

大城市里の小女人 提交于 2019-12-05 00:39:32
问题 This is killing me and any help would be greatly appreciated. I want to connect to an open network using wifi manager. The problem I am having is that the code claims connection to any network - even non-existing ones. Below is the entire code that gets executed and gets called with the SSID of a network. It does not matter what string you pass to it as the SSID of a network, even if no such network exists in any shape or form, the enableNetwork claims returns true, which I believe means it

Determine Network Connection Bandwidth (speed) wifi and mobile data

∥☆過路亽.° 提交于 2019-12-04 12:13:01
问题 I want to get Network Connection Bandwidth in kbps or mbps. if the device is connected to wifi then it should returns the network bandwidth(speed) as well as mobile data. it will returns wifi capablity rate but i want exact data transfer rate. public String getLinkRate() { WifiManager wm = (WifiManager)getSystemService(Context.WIFI_SERVICE); WifiInfo wi = wm.getConnectionInfo(); return String.format("%d Mbps", wi.getLinkSpeed()); } 回答1: You can't just query for this information. Your Internet

connect wpa2 enterprise wifi connection programmatically in android

你。 提交于 2019-12-04 11:23:12
I just tried few codes for wpa2 enterprise connection in android but nothing is connecting i want a right code to connect the right network. right now i have used this answer but i need few clarification because this answer is very old one. here i am attaching some screenshot about connection clarification. In this you can see identity and password WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.SSID = "\"" + networkSSID + "\""; wifiConfiguration.BSSID = Bssid; wifiConfiguration.hiddenSSID = true; wifiConfiguration.status = WifiConfiguration.Status.DISABLED;