wifimanager

Set static IP and gateway programmatically in Android 6.x (Marshmallow)

早过忘川 提交于 2019-11-29 01:28:25
Can anybody tell me how can I set the static IP and gateway programmatically in Android 6? I have read here and here . Settings.System is not working anymore and goolgle says WIFI_STATIC_IP was deprecated in API level 17 and Use WifiManger instead. Unfortunately I cannot find anything about it in WifiManger and WifiConfiguration classes. Since there's no official API I have to come up with a solution by modifying samples from the following code snipet and this answer . This solution works on devices from Lollipop upwards. @SuppressWarnings("unchecked") public static void

How to get signal strength of connected WiFi android?

半世苍凉 提交于 2019-11-29 00:37:10
I want to get signal strength of this wifi which is connected with my device. This is probably easy. But I am beginner. And It's homework. How to get it? I tried this code. But it doesn't work. registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); int state = wifi.getWifiState(); if(state == WifiManager.WIFI_STATE_ENABLED) { List<ScanResult> results = wifi.getScanResults(); for (ScanResult result : results) { if(result.BSSID.equals(wifi.getConnectionInfo()

Android M: Unable to remove WIFI AP programmatically

人盡茶涼 提交于 2019-11-28 12:06:39
In Android M: I am using below code to remove current connected WIFI AP. void RemoveConnectedNetwork(){ int ID=_wifiManager.getConnectionInfo().getNetworkId(); Log.d("test", "network id = ["+ID+"]"); boolen ret =_wifiManager.removeNetwork(ID); Log.d("test", "removeNetwork return ="+ret); _wifiManager.saveConfiguration(); } but RemoveConnectedNetwork() always returns false . Although this API was working well in previous releases. Any solution that can be achieved on this using any other API in Android M? Thanks. Megha There are some changes in the Wifi Manager in Android 6.0. Any Wi-Fi

Android : Reconnect to Wi-Fi after entering coverage area while screen turned off

吃可爱长大的小学妹 提交于 2019-11-27 21:44:22
I have been struggling with automatically turning on Wi-Fi as soon as the device is within range of an access point without turning on the screen. It has been very frustrating to test and figure out a solution, especially since different devices have completely different results. Base Test Keep the screen turned off during this test. The application should hold a WifiLock. Walk out of WiFi coverage and stay there for a minute. Walk back into coverage. Result : The Wifi is not reconnected immediately and thus app does not reconnect to server. Depending on the device and settings, sometimes it

How to be notified when a peer is no longer available in the Wi-Fi Direct range?

。_饼干妹妹 提交于 2019-11-27 20:12:51
I am developing an Android application based on the use of Wifi Direct API. I have registered in my Activity a BroadcastReceiver in order to be notified about the following Wifi Direct events: WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION I believed that any change in the list of peers (the inclusion or exclusion of a peer in the Wifi Direct range) could trigger the BroadcastReceiver . In my app, when a new peer is found, its name is correctly

Set static IP and gateway programmatically in Android 6.x (Marshmallow)

筅森魡賤 提交于 2019-11-27 15:59:22
问题 Can anybody tell me how can I set the static IP and gateway programmatically in Android 6? I have read here and here. Settings.System is not working anymore and goolgle says WIFI_STATIC_IP was deprecated in API level 17 and Use WifiManger instead. Unfortunately I cannot find anything about it in WifiManger and WifiConfiguration classes. 回答1: Since there's no official API I have to come up with a solution by modifying samples from the following code snipet and this answer. This solution works

How to get signal strength of connected WiFi android?

白昼怎懂夜的黑 提交于 2019-11-27 15:22:46
问题 I want to get signal strength of this wifi which is connected with my device. This is probably easy. But I am beginner. And It's homework. How to get it? I tried this code. But it doesn't work. registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); int state = wifi.getWifiState(); if(state == WifiManager.WIFI_STATE_ENABLED) { List<ScanResult> results = wifi

How can I set ProxySettings and ProxyProperties on Android Wi-Fi connection using Java?

穿精又带淫゛_ 提交于 2019-11-27 07:01:36
How can I set ProxySettings and ProxyProperties on an Android Wi-Fi connection using Java (programatically)? As ipAssignment, linkProperties, ProxySettings and ProxyProperties are hidden fields within WifiConfiguration on Android 3.1 and up, I need to be able to enum the class and use the fields. Following the code sample using the link below, I can set a static IP address, gateway and DNS for a particular Wi-Fi connection, but I also need to set Wificonfiguration.ProxySettings.STATIC and ProxyProperties See Stack Overflow question How to configue a static IP address, netmask, gateway

Android M: Unable to remove WIFI AP programmatically

感情迁移 提交于 2019-11-27 06:45:43
问题 In Android M: I am using below code to remove current connected WIFI AP. void RemoveConnectedNetwork(){ int ID=_wifiManager.getConnectionInfo().getNetworkId(); Log.d("test", "network id = ["+ID+"]"); boolen ret =_wifiManager.removeNetwork(ID); Log.d("test", "removeNetwork return ="+ret); _wifiManager.saveConfiguration(); } but RemoveConnectedNetwork() always returns false . Although this API was working well in previous releases. Any solution that can be achieved on this using any other API

How to get each device's IP address in Wi-Fi Direct scenario?

别来无恙 提交于 2019-11-27 03:28:36
Starting from ICS, Wi-Fi Direct is introduced. Normally, we use the WifiP2pManager class to operate on Wi-Fi Direct, but it seems that it can only retrieve the GroupOwner IP address after connected. But, actually, any device all came negotiate to become the GroupOwner. In Upper Application, we need to get the peer's IP address, or each peer's IP address in a group so that we can send/communicate with them. How to get each IP address in Wi-Fi Direct? Include own IP address and each peer in the group? I encountered the same problem. Since both devices know the group owner's ip, it is already