That's right, if you use ConnectivityManager, specify only connection information (WiFi, mobile, WiMax, etc.), and if it is connected or not.
To provide data connectivity, you can ping:
public static boolean ping() {
try {
SocketAddress addr = new InetSocketAddress("www.example.com", 80);
Socket socket = new Socket();
socket.connect(addr, 5000);
socket.close();
return true;
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
source
share