This tag is used for internet related questions on the Android Operating System.
Questions tagged [android-internet]
228 questions
744
votes
6 answers
Detect whether there is an Internet connection available on Android
Possible Duplicate:
How to check internet access on Android? InetAddress never timeouts
I need to detect whether the Android device is connected to the Internet.
The NetworkInfo class provides a non-static method isAvailable() that sounds…

Dan
- 15,948
- 20
- 63
- 92
149
votes
16 answers
Detect if Android device has Internet connection
I need to tell if my device has Internet connection or not. I found many answers like:
private boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager)…

Buda Gavril
- 21,409
- 40
- 127
- 196
70
votes
7 answers
Http Get using Android HttpURLConnection
I'm new to Java and Android development and try to create a simple app which should contact a web server and add some data to a database using a http get.
When I do the call using the web browser in my computer it works just fine. However, when I do…

user1119112
- 807
- 1
- 8
- 10
32
votes
14 answers
Android - Programmatically check internet connection and display dialog if notConnected
I am working on a live project. and when user click on the app. the welcome screen appears(there is a webview on that screen). and if the internet is not connected then the app crashes. Basically, my problem is to check programmatically that is…

Java_Android
- 735
- 2
- 9
- 15
29
votes
6 answers
How to forget a wireless network in android programmatically?
I am working on an app which wifi , where user will be asked to enter password for the scanned network he selects, if user enters a correct password, it connects and works well. But when user enters wrong password, a new network is added with that…

Adarsh H S
- 1,208
- 6
- 21
- 42
19
votes
4 answers
android how to get indicate when the internet connection is lost?
I'm developing an android application and I want to get a notification when the internet (wifi or packet data connection) connection is lost. On my approach I can get the status of the connection as:
private boolean isNetworkAvailable()…

Dinithe Pieris
- 1,822
- 3
- 32
- 44
18
votes
2 answers
How to check the internet connectivity within the network in Android (using internet of some other device through HOTSPOT)
I have a requirement where I want to check whether there is any internet connectivity when I am connected with the network.
For example, I have device A and device B.
Device A is connected with hotspot with that of device B. In device A, I get it as…

android developer
- 1,253
- 2
- 13
- 43
16
votes
5 answers
Android internet connectivity check problem
I'm new to Android development and working on an Android application that requires the phone to be connected to the internet, through either Wifi, EDGE or 3G.
This is the code that I'm using to check whether an internet connection is…

Charles
- 2,615
- 3
- 29
- 35
16
votes
5 answers
@font-face declarations don't work in Android 4.3 Internet browser?
My Samsung Galaxy S3 phone recently upgraded from Android 4.1.3 to Android 4.3. Now several websites I designed which I tested in the Android internet browser are not displaying fonts I have declared with @font-face. What do I need to do to fix…

David
- 1,187
- 1
- 10
- 22
14
votes
2 answers
Can't get HttpParams working with Postrequest
I can't get the HttpParams-stuff from the Android-API working.
I just wan't to send some simple Parameters with my Postrequest. Everything is working fine, except for the parameters. The code to set the parameters to the postrequest:
HttpParams…

Christoph Haefner
- 1,093
- 1
- 9
- 25
14
votes
3 answers
Cannot make a static reference to the non-static method getSystemService(String) from the type
I have this function which network connection
public boolean isNetworkConnected() {
ConnectivityManager conManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo =…

Developer
- 6,292
- 19
- 55
- 115
13
votes
2 answers
Why does ping works on some devices and not others?
I have the following code in my app:
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("/system/bin/ping -c 1 8.8.8.8");
return process.waitFor();
I see that it works (i.e. returns 0) on some devices (e.g. Motorola G) but…

Adil Hussain
- 30,049
- 21
- 112
- 147
13
votes
2 answers
Simulate Slow Internet Connection on a REAL device?
I need to test my application in conditions where even 2G Internet connectivity isn't at its full coverage (i.e. 2 bars instead of 4, 2G).
I prefer conducting these tests over WiFi.
Is there a way (programmatically or otherwise) to tell the Android…

scatmoi
- 1,958
- 4
- 18
- 32
10
votes
1 answer
ConnectivityManager.EXTRA_NO_CONNECTIVITY is always false on Android Lollipop
I am using this piece of code to detect Internet connection state changes. It works fine on Android<5.0, but on API 21 this:
intent.getExtras().getBoolean(ConnectivityManager.EXTRA_NO_CONNECTIVITY)
is always false. How to make this code to work on…

fragon
- 3,391
- 10
- 39
- 76
10
votes
5 answers
ask user to connect to internet or quit app (android)
i am working on an image gallery app, in which application is retrieving images from internet.
so i want to prompt a dialog-box to ask user to connect to internet or quit application.
show user both WiFi and Carrier network option.

android question
- 137
- 2
- 10