Questions tagged [android-connectivitymanager]

159 questions
1
vote
0 answers

WiFi incorrect password returns true

I am trying to add the wifi network on my device like this public static boolean connectToWifi(String ssid, String password) { WifiConfiguration wifiConfig = new WifiConfiguration(); wifiConfig.SSID = String.format("\"%s\"", ssid); …
AngelJanniee
  • 613
  • 1
  • 11
  • 30
1
vote
0 answers

connectivityManager.startUsingNetworkFeature & connectivityManager.requestRouteToHost gives Error for Api Level 26

I was using below two methods for api level < 26 but for Api level > 26 it gives error can some one help how to fix below chunks. Thanks In advance. connectivityManager.startUsingNetworkFeature //activate mobile connection in addition to other…
user3256451
  • 475
  • 4
  • 14
1
vote
1 answer

Access to ConnectivityManager inside a library which has no Activity or context

I'm building a android library with some functionality, which will be used by 3rd party apps. Within my library I need to access network related stuff, and need to access Context.getSystemService() to get ConnectivityManager. For e.g. - …
1
vote
1 answer

Make connectivity listener run as long as the phone is on?

I have followed this tutorial and I got the result where I click the button, the connectivity state is shown (connected to internet or not) and it keeps running for as long as I'm running the app. But if I exit, the connectivity listener stops…
1
vote
6 answers

How to get network state change on android?

I have broadcast receiver for "CONNECTIVITY_CHANGE". When I print the extra using this: intent.getExtras().toString() I can see that if I disable WIFI, I receive 2 network change. WIFI DISCONNECTED MOBILE CONNECTED However, when I try to…
Adrian
  • 273
  • 1
  • 4
  • 14
0
votes
1 answer

Android ConnectivityManager callbacks not working

I need to check the current internet availability. Since many of the old calls are deprecated I use the ConnectivityManager.NetworkCallback() approach with a callback. However, when implementing something like this: private val…
Tobias Reich
  • 4,952
  • 3
  • 47
  • 90
0
votes
0 answers

Android ConnectivityService and android.net.ConnectivityManager$TooManyRequestsException

I've collected a lot of crashes about TooManyRequestsException. Caused by: android.net.ConnectivityManager$TooManyRequestsException at android.net.ConnectivityManager.convertServiceException(ConnectivityManager.java:3510) at…
0
votes
0 answers

android.net.ConnectivityManager$TooManyRequestsException

Note: Don't mark this as duplicate as this existing answer does not solved my query android.net.ConnectivityManager$TooManyRequestsException in android while network call Update Wed 28 Jun : Found this is happening only on Android 11 devices. I have…
0
votes
0 answers

ConnectivityManager.requestNetwork() network not shown in Wifi settings

In my use case an IOT Device creates a local Wifi Network that my android phone should connect to. To connect to this network I am using connectivityManager.requestNetwork(...) and receive a confirmation of connection inside of override fun…
0
votes
1 answer

Callback called twice when I rotate the device but once in application launch

I have a sample in Github (https://github.com/alirezaeiii/Movies) where I have a utility class in order to check internet network connection : class NetworkUtils(context: Context) : ConnectivityManager.NetworkCallback() { private val…
Ali
  • 9,800
  • 19
  • 72
  • 152
0
votes
0 answers

Unresolved Reference Errors Querying Network Info

fun checkNetworkInfo(context: Context) { val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetwork: NetworkInfo? = cm.activeNetworkInfo val isConnected: Boolean =…
0
votes
1 answer

Android ConnectivityManager.requestNetwork() timed out when connecting to a hidden network

I'm trying to connect a hide SSID which is SAE over ConnectivityManager. But the result is over time. The application can't connect to SSID. I'm trying to change the SSID to not hide. It works well. Here is the connect fun …
0
votes
0 answers

Android: Http request fails in wifi connection

I have an issue with HTTPS requests. I do not know why? But I have been observing that in the same wifi(mobile hotspot) youtube and Instagram loads very well. But in my app, I have tried Picasso, Glide, OkHttp, HttpURLConnection, etc. These all take…
0
votes
0 answers

android connectivity manager detect WIFI6 ("802.11ax" )

I am currently using ConnectivityManager.NetworkCallback to detect a change in the network state. However, Connectivity Manager does not seem to recognize WIFI6 (802.11ax). Ex) When WIFI6 is connected by turning on WIFI, Callback is not being…
Juro
  • 73
  • 1
  • 7
0
votes
1 answer

Check For Internet Connectivity Causes Android Not Responding Error

This is my first app, so I'm still learning. I created a class (Check Network) that I call on to check for internet connectivity before I display an ad. The method in the class returns a boolean, here is the first method - a test connection to…