Questions tagged [android-connectivitymanager]
159 questions
3
votes
1 answer
How to dispose Observables in lifecycle independent classes?
I have a network change notifier class based on ConnectivityManager.NetworkCallback and i want to update some fields when network is available;
override fun onAvailable(network: Network?) {
super.onAvailable(network)
val db =…

Manoj Perumarath
- 9,337
- 8
- 56
- 77
3
votes
1 answer
WifiManager enableNetwork reverts to previous network after a few seconds
On Android 8.1.0 and above, I am coming up against a major issue.
When connecting to a network with no internet using enableNetwork, Android decides after a few seconds to put the device back on the previous network.
I have intentionally connected…

Smashman
- 165
- 4
- 11
3
votes
2 answers
Can not check network info programmatically in battery save mode in android device
I want to check connection state in my android app. I call the next method in onResume:
public boolean isThereInternetConnection() {
boolean isConnected = false;
ConnectivityManager connectivityManager =
…

Alex D.
- 1,424
- 15
- 40
3
votes
0 answers
ConnectivityManager.NetworkCallback never gets available callback
I'm trying to force a network request over the cellular network. To do so, I'm asking for a mobile network callback from the ConnectivityManager like so:
private static final String LOG_TAG = "Main";
@Override
protected void onCreate(Bundle…

David Albers
- 253
- 4
- 10
3
votes
4 answers
Android getActiveNetwork always returns null
I am developing a Tango Application with Unity and the Tango SDK, however, I need to be able to check the device's Wifi connectivity and connect to a Wifi Network accordingly.
With that in mind I started working on an Android Unity Network Plugin,…

Geoab
- 75
- 6
2
votes
1 answer
How to get Try Again button click event using NetworkCallback?
I am trying to get Try Again system popup click event using NetworkCallback,
Actually, I have WIFI hotspot & password and I am trying to connect that hotspot but if there are no any available network then It should show custom logic in 'Try Again'…

Hardik Parmar
- 712
- 2
- 13
- 28
2
votes
1 answer
Why does WifiNetworkSpecifier with capability NET_CAPABILITY_INTERNET always return onUnavailable?
I'm trying to get my app to connect to a WiFi AP to provide Internet with WifiNetworkSpecifier using code like this. But it's always calling onUnavailable in the NetworkCallback.
private val callback: ConnectivityManager.NetworkCallback = object :…

georgiecasey
- 21,793
- 11
- 65
- 74
2
votes
1 answer
Is it relevant to check network capabilities if I specified them in the network request
In my code, I need to track the internet connection and make appropriate changes. First of all, I create a network request, then register a network callback using the ConnectivityManager.
val networkCallback = createNetworkCallback()
val…

Hayk Mkrtchyan
- 2,835
- 3
- 19
- 61
2
votes
2 answers
Android developer: how to detect when WiFI hotspot is turned on/off
I have registered ConnectivityManager NetworkCallback as follows:
val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val builder = NetworkRequest.Builder()
…

Juha
- 349
- 2
- 11
2
votes
1 answer
How to validate password of wifi and connect/disconnect specific wifi network in android 10
I am trying to connect a specific wifi network in android 10 (API level 29). I have written a function for this is given below,
private void connectToWifi(final String ssid, String password) {
count=0;
wifiManager = (WifiManager)…

HemantZ
- 23
- 1
- 6
2
votes
0 answers
Handle network availability in Interceptor and cancel the request Kotlin Android
In Android application, is it possible to check network availability in Interceptor. And only if the network is available, allow the request. If no network, cancel/abort the request.
Also, is it possible to get the network status without…

Joseph
- 1,060
- 3
- 22
- 53
2
votes
2 answers
Getting "BLOCKED" network state when Android's data saver is off
I am developing an app to be used on a specific tablet running Android 7.0. I'm using a Service to send periodic DatagramPackets. I can only use mobile networks. I check the connectivity status using ConnectivityManager, NetworkInfo and…

Jon
- 891
- 13
- 32
2
votes
0 answers
Multiple NetworkCallback events (onAvailable) affecting app performance
I need to display an alert screen when the device is losing network connectivity. When connectivity is back, I hide this alert. I'm using ConnectivityManager.NetworkCallback() to determine connectivity status. The app is being run on API 22…

Andrey Rankov
- 1,964
- 2
- 17
- 33
2
votes
1 answer
How make a SMB connection through Network object in Android?
I'm trying to make a SMB (Samba) connection to get a list of files and download them with the SMBClient of smbj library.
To that I have to connect to a specific network and use that class, but in Android Q I have to change the way to connect to the…
2
votes
0 answers
Error in cordova android app with ConnectivityManager
Hi cordova and android masters) I new in "cordova development".
I built android app on cordova. My app can open files with use of com.megster.cordova.FileChooser plugin. But since august app has a error when selecting and open file (file storage in…

Шепелев Данила
- 21
- 2