Questions tagged [android-connectivitymanager]
159 questions
0
votes
1 answer
Is there a way to detect internet connectivity change when phone is connected to wifi over hotspot?
Phone A has mobile data ON and is sharing internet via Wi-Fi hotspot to Phone B. If Mobile Data is TURNED OFF in phone A, no connectivity change is received @PhoneB. How can I get this change in Phone B when mobile data is turned ON/OFF in Phone A?…

user1517153
- 336
- 2
- 10
0
votes
1 answer
How to check if device got disconnected from the Internet?
I have found a code about checking whether or not the device is connected to the internet. The code is as follows
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager)…

el diablo
- 35
- 8
0
votes
0 answers
How to run android application only when connected to certain networks or VPN?
Is there a way to restrict running of the app to the server it connects if it only connects through certain networks or VPN (such as eduroam). Is this a good way to restrict an app to run only at certain locations(i.e when connected to a network).…

papyrus
- 41
- 2
0
votes
2 answers
when i open my android app when no WiFi connected it show no WiFi connected as i given in the code
but when i connect my app with the WiFi it still show no WiFi connected , so i have to close the app and open it again with WiFi connected.
if (wifimanager.setWifiEnabled(true)) {
punchin.setOnClickListener {
if…

mudassir hasan
- 33
- 1
- 7
0
votes
1 answer
How to check if a device is under Connecting state when connecting to wifi or mobile data?
I am developing the android app which runs my web service at app startup. My app is basically the home app of the device. So that's mean that When user will reboot the device, My app will come in front of him.
So far that is great. But I have…

A.s.ALI
- 1,992
- 3
- 22
- 54
0
votes
0 answers
Is there a way to detect if my current wifi is different from the previously connected wifi?
I am trying to figure out changed wifi connection while in the background. I want to make sure if my current wifi is same as previously connected wifi no action is taken while if its a new wifi that gets configured then I want my code to trigger.…
user2386226
0
votes
1 answer
How can I get a list of available networks (GSM/LTE, WiFi, etc) in Android
I try get a list of available networks, but when WiFi is on I see only "WIFI," although GSM/LTE is enabled.
Is there a good way to get the list available networks?
I'm trying to do so:
ConnectivityManager connManager = (ConnectivityManager)…

SergeyYu
- 354
- 1
- 5
- 20
0
votes
2 answers
ConnectivityManager connMgr = (ConnectivityManager) getContext().getSystemService returning null on load
I'm getting an error in ConnectivityManager when loading the app. I've used it a lot but this is the first time I've encounter it.
it says null but I don't have an idea what this error cause.
this is my code:
final ConnectivityManager connMgr =…

FroyoDevourer
- 129
- 11
0
votes
1 answer
Network Connectivity check differs in Android 6 and Android 7 on app startup
My app is a kiosk mode app (unless the user enters a code, he won't be able to access any Android apps). So, when the tab boots up, there are some settings to be done in a service.
I am using the below code to check for network connectivity (this…

user198530
- 331
- 1
- 3
- 10
0
votes
1 answer
How to detect WIFI is connected, but no internet (data limit is over / no signal)
I want to check whether ''Wifi' is connected, but how to detect internet is available or not? Because within my 'MainActivity.java' I' checking the internet connection and also the availability of internet by following code.
public static boolean…

Nuwan Withanage
- 393
- 7
- 19
0
votes
1 answer
Connection detector returns false through background service
In my application I want to get GPS location of through a foregrond service and receiver. every thing is running fine but after two or three successful run. service is not able to detect internet and returns false
here is the code
Code for receiver…

Kamleshwer Purohit
- 357
- 2
- 16
0
votes
3 answers
Boolean Method for checking Internet Connectivity returning only false
In my application I am checking whether the mobile is connected to the internet or not, using WIFI or mobile data connection but the problem is my code is always showing internet connection not available through my device is connected to WIFI.
Here…

Himanshu Agnihotri
- 179
- 1
- 10
0
votes
1 answer
Schedule a Job when Internet goes off with Android O
Here is what I want to achieve:
Monitor network state in the background.
When the device doesn't have internet.
Trigger a Job.
Currently I see, there is no possibility to trigger a job when the device goes in "No Internet" state. Any workaround…

shailesh mota
- 309
- 2
- 7
0
votes
3 answers
find if there is an active internet connection java android
I'm trying to find out if there is an active internet connection in my app.
I need to know if I can access the network without any errors, sometimes I get "true" response even though I have not internet connection and that is because i'm still…

OrrGorenn
- 347
- 1
- 5
- 15
0
votes
2 answers
Checking Online Connectivity Always Returns True
I have a dynamic Broadcast Receiver set up in my Main Activity that should display a Toast message whenever my Network State Changes. I connect online, run the application, the "You are online!" Toast message displays, I then turn the internet off…

Mark F
- 1,523
- 3
- 23
- 41