wifimanager

Android using wifimanager to connect to WPA-PSK secured network

折月煮酒 提交于 2019-12-04 02:21:43
问题 so I have trawled true all threads in here and any where else where google would take me. But still I am having problems connecting to WPA PSK networks. Here is my code, I have 2 edittext fields from which I read SSID and PSK and then one checkbox to select if SSID is hidden or not. EditText mSSID = (EditText) findViewById(R.id.wifiTVssidcurrent); String networkSSID = mSSID.getText().toString(); EditText mWPA = (EditText) findViewById(R.id.wifiTVwpacurrent); String networkWPA = mWPA.getText()

Connecting to WiFi network automatically in Android 5 and 6

被刻印的时光 ゝ 提交于 2019-12-04 01:51:02
问题 Been struggling with connecting to WiFi network in Android 5 and 6 for a while and other similar questions don't seem to work for me. I could get the same code working in Android 4.4.2 Adding the code snippet below. String networkSSID = getSsid(); String networkPass = getNetworkPass(); WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "\"" + networkSSID + "\""; conf.status = WifiConfiguration.Status.ENABLED; conf.priority = 40; conf.allowedProtocols.set(WifiConfiguration.Protocol

How to get the MAC address of an android device(WIFI is switched off) through code?

回眸只為那壹抹淺笑 提交于 2019-12-03 21:14:30
I need to design an Android app that should display the MAC address of the device.. I have already done the following coding.. WifiManager wifimanager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo winfo = wifimanager.getConnectionInfo(); String MACAddress = winfo.getMACAdress(); But the problem is, this code is working only when wifi is turned on, but my requirement is to find the MAC address whether wifi is turned on or not. Here is the code to getMac Address without using wifi manager. public static String getMACAddress(String interfaceName) { try { List<NetworkInterface>

Extracting SSID password from supplicant config file in Android

谁都会走 提交于 2019-12-03 20:19:59
I'm trying to write an Android SYSTEM app that extracts the Wifi password from the supplicant configuration file (/data/misc/wifi/wpa_supplicant.conf). Using adb with root permissions, I can read the file without any problem and see the password in plain text. However, when I try to open the file programatically I get EACCES (Permission denied) error. That happens even though my app is running as 'system' user (I define android:sharedUserId="android.uid.system" in the manifest), the app is signed with the system private key and pushed into /system/app. I know for a fact that it can be done

Scanning for wifi signals only in 2.4Ghz band

感情迁移 提交于 2019-12-03 15:38:43
I need to scan for available Wi-Fi signals and their strengths. I'm using wifiManager.startScan(); and asynchronous wifiManager.getScanResult(); . On devices without support of 5GHz band it takes about 500ms to get the results, on devices with 5GHz band support it takes about 2s, and that is too much for me. I guess the 1.5s delay is in searching the whole 5GHz band. Is there any way I could tell the device to scan only in the 2.4GHz band, or any other way I could get the results faster (for example through NDK)? I searched through the entire web and found nothing, so I guess this is the only

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

旧巷老猫 提交于 2019-12-03 15:35:56
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 solve this problem or find an alternative solution? This is a link to the documentation. https:/

Determine Network Connection Bandwidth (speed) wifi and mobile data

旧时模样 提交于 2019-12-03 07:32:20
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()); } You can't just query for this information. Your Internet speed is determined and controlled by your ISP, not by your network interface or router. So the only way

Oreo Wifi Connectivity

故事扮演 提交于 2019-12-03 07:16:37
I am working on an IoT app in which there is an on boarding process where the user connects to an access point, which has not internet connectivity, configure the device and then connects to his home Wifi network. Android 8 devices have been causing some problems, disconnecting from the access point and reconnecting to a previously configured network. I am assuming this is related to the connectivity update which was introduced in Android 8, from section Seamless Connectivity in this link : On compatible devices, automatic activation of Wi-Fi when a high quality saved network is nearby. My

how to obtain the ip address of the connected wifi router in android programmatically?

会有一股神秘感。 提交于 2019-12-03 03:56:00
I want to obtain the ip address of the the wifi router to which my android phone is connected? I know that we can get the mac/BSSId and SSID by using the android APIS but I don't find the way to find the way to find the ip address of it? I found the code for obtaining the ip address of phone owns wifi router WifiManager myWifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo myWifiInfo = myWifiManager.getConnectionInfo(); int ipAddress = myWifiInfo.getIpAddress(); System.out.println("WiFi address is " + android.text.format.Formatter.formatIpAddress(ipAddress)) but failed to get

Get Android DhcpInfo connected via Ethernet

本小妞迷上赌 提交于 2019-12-03 03:39:16
How to get DhcpInfo() (gateway ip, netmask, dns, etc) of android device connected via Ethernet? I know how to get it if device connected via Wifi and using ACCESS_WIFI_STATE permission: WifiManager wifi = (WifiManager) context.getSystemService(Service.WIFI_SERVICE); DhcpInfo dhcp = wifi.getDhcpInfo(); But I still not found the way to get it if device connected via ethernet... Thanks In your AndroidManifest.xml file <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> Your code: ConnectivityManager