Check Internet Connection in Android | Android Studio

Check Internet Connection in Android | Android Studio

Inside Android

6 лет назад

22,100 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ivan CR
Ivan CR - 22.06.2021 17:07

2021-06-22: Saved my application! Thanks!

Ответить
HP CRM
HP CRM - 29.10.2020 13:19

It is only checking the Network not actually the internet

Ответить
Ever Sullca
Ever Sullca - 23.07.2020 19:34

detect internet connection or network connection?

Ответить
Isaias M. Poncio
Isaias M. Poncio - 21.07.2020 21:32

pure gold, thanks master

Ответить
Shubh
Shubh - 28.05.2020 09:57

Work fine and thank you sir lekin kya hm isko always track krne wala bna skte hai taki jaise hi data close ho app detected kr le plz sir reply

Ответить
Drewphics Prints and Graphic Designs
Drewphics Prints and Graphic Designs - 25.05.2020 15:47

It only checks if the phone is connected to a network. It doesn't check for the availability of internet.

Ответить
Pro Blogging Tips 4u
Pro Blogging Tips 4u - 04.01.2020 21:01

Thanks

Ответить
Tsm News
Tsm News - 17.11.2019 04:27

Aap se ek application bawana chahata hu 9519581688 Jo aap Ka charge hai batado

Ответить
jesus salcido
jesus salcido - 22.06.2019 17:50

Gracias we, me sirvió tu código :D

Ответить
Meet Soni
Meet Soni - 10.06.2019 20:44

Bhai ek bar run karke bhi dikha deta , to jyada maja aata

Ответить
Evgeni Ivlvv
Evgeni Ivlvv - 20.05.2019 14:27

Who is too lazy to rewrite video:
private boolean haveNetwork() {
boolean have_WIFI = false;
boolean have_MobileData = false;
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo[] networkInfo = connectivityManager.getAllNetworkInfo();

for (NetworkInfo info:networkInfo) {
if (info.getTypeName().equalsIgnoreCase("WIFI")) {
if (info.isConnected()) {
have_WIFI = true;
}
}
if (info.getTypeName().equalsIgnoreCase("MOBILE")) {
if (info.isConnected()) {
have_MobileData = true;
}
}
}
return have_MobileData || have_WIFI;
}

Ответить
Soumoutera Awa
Soumoutera Awa - 15.05.2019 12:19

hello sir i want to calculate the network latency time and rate in android can you help me please?

Ответить
Funny Frzzy Friend
Funny Frzzy Friend - 03.05.2019 15:49

it not working

Ответить
Priyanka Patil
Priyanka Patil - 18.03.2019 19:23

thank u soo much. its works fine

Ответить
Mateus Amancio
Mateus Amancio - 08.03.2019 06:35

You show the code, but don`t show working... I lose my time seeing it!

Ответить
Learn coding
Learn coding - 24.02.2019 22:34

hello bro whey else if ????? just else if statement ...... else

Ответить
The New Tech Guy
The New Tech Guy - 20.02.2019 01:45

Tip. If you share code, think you get more likes :P Atleast you got one like from me. Good work

Ответить
Md Jahidul Islam
Md Jahidul Islam - 16.01.2019 15:25

How to handle slow internet connection? Sometimes internet is connected but because of the slow network get/post request are not successful,

How to resolve it? Thanks

Ответить
Artist Dipin
Artist Dipin - 25.05.2018 19:12

How I can check whether the connected network is having active network or not. This code will work when wifi or mobile data activated on the settings. But we need to check the actual availability of the network access.... When we are accessing some online resources like FireBase, the actual connectivity needed. Otherwise app will crash. If you have any solution for that?

Ответить
Whatsapp Status Creations
Whatsapp Status Creations - 06.05.2018 18:28

you solved my problem

Ответить