android-connectivitymanager

Android Q always reusing the first entered credentials to connect to the WiFi network

♀尐吖头ヾ 提交于 2021-02-04 07:00:48
问题 I am trying to connect to WiFi using the WifiNetworkSpecifier on Android Q. The problem which I run into is Android always using the last valid credentials to connect to the AP, even after I manually provide the new, updated credentials to the WifiNetworkSpecifier. This is the flow: Successfully connect to the AP. Change the password of the WiFi network. Run the app, try to connect again with the updated credentials (new, valid password provided) but the app can't connect to the WiFi

BindProcessToNetwork not working on a specific device

微笑、不失礼 提交于 2021-01-28 05:07:13
问题 I have an app that's custom built for a client and not available in the Play Store that basically makes some network calls when it detects that the device is connected to their WiFi. This should happen even if it has no internet connection, every request that the app makes is to a local address. The problem comes with the new batch of tablets that the client has purchased (Galaxy Tab Active 2, Android 8.1.0, Build number M1AJQ.T395XXU3BRJ5), which will always prefer a connection with internet

Android Q Wifi connection via WifiNetworkSpecifier lose connection immediately after connection established

时光总嘲笑我的痴心妄想 提交于 2021-01-18 04:22:50
问题 I'm currently trying to connect to a wifi network. I used the below code. WifiNetworkSpecifier specifier = new WifiNetworkSpecifier.Builder() .setSsid(ssid) .setBssid(MacAddress.fromString(bssid)) .setWpa2Passphrase(password) .build(); NetworkRequest request = new NetworkRequest.Builder() .addTransportType(NetworkCapabilities.TRANSPORT_WIFI) .setNetworkSpecifier(specifier) .build(); ConnectivityManager manager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context

WiFi Network Connection keeps disconnecting on Android Q

久未见 提交于 2020-07-19 05:58:52
问题 I use the WiFi Network Request API to connect to a network on android Q. The connection becomes available but gets lost. Here is my code public void registerNetworkCallback() { try { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); WifiNetworkSpecifier specifier = new WifiNetworkSpecifier.Builder() .setSsid("r_guest").setWpa2Passphrase("guest").build(); NetworkRequest networkRequest = new NetworkRequest.Builder()

Android 10 / API 29 : how to connect the phone to a configured network?

给你一囗甜甜゛ 提交于 2020-07-05 03:19:27
问题 I am working on an application in which one the user has to follow these steps : connect the phone to a wifi ; connect the phone to a dedicated hotspot from a connected object. When the user is connected to the dedicated hotspot of the connected object, the application does some HTTP requests in order to configure it. Then, I would like to reconnect automatically the application to the global wifi of the step 1. From API 21 to API 28 this feature is very easy to implement because I know the

ConnectivityManager.getActiveNetworkInfo() / NetworkInfo is deprecated in API 29. What's an alternative?

狂风中的少年 提交于 2020-06-16 03:34:12
问题 Seem like whole NetworkInfo is deprecated on API 29. So I am looking for an alternative to check if the network is connected. E.g. alternative to connectivityManager.activeNetworkInfo?.isConnected == true Sidenote: I know there is a callback now, but I'd like to get this info synchronously. Also, of course I'm aware that it may not be a precise info though I'd like to have it. 回答1: The solution is this: val capability = connectivityManager.getNetworkCapabilities(connectivityManager

Binding to cellular network with bindProcessToNetwork does not work

柔情痞子 提交于 2020-04-07 07:09:26
问题 I am trying to bind to a cellular network on demand (wifi is still running). I have the following code: override fun onAvailable(network: Network) { super.onAvailable(network) Toast.makeText(this@MainActivity, "CELLULAR READY", Toast.LENGTH_SHORT).show() Log.e("darran", "network info is: " +connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)) Log.e("darran", "network is metered: " +connectivityManager.isActiveNetworkMetered) Log.e("darran", "bind is tru: " +connectivityManager

Binding to cellular network with bindProcessToNetwork does not work

早过忘川 提交于 2020-04-07 07:08:26
问题 I am trying to bind to a cellular network on demand (wifi is still running). I have the following code: override fun onAvailable(network: Network) { super.onAvailable(network) Toast.makeText(this@MainActivity, "CELLULAR READY", Toast.LENGTH_SHORT).show() Log.e("darran", "network info is: " +connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)) Log.e("darran", "network is metered: " +connectivityManager.isActiveNetworkMetered) Log.e("darran", "bind is tru: " +connectivityManager

Get Android DhcpInfo connected via Ethernet

时光总嘲笑我的痴心妄想 提交于 2020-01-12 02:19: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 回答1: In your AndroidManifest.xml file <uses-permission android:name="android.permission.INTERNET" /> <uses

Get Android DhcpInfo connected via Ethernet

风格不统一 提交于 2020-01-12 02:19:02
问题 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 回答1: In your AndroidManifest.xml file <uses-permission android:name="android.permission.INTERNET" /> <uses