0

http://pastebin.com/G4UrTT7Z

What can I do to check for a working internet connection? Or how do I check if connection is lost?

Can someone help me with this ?

I suppose this is a IOException. I am not sure. When watching logcat and console I don't see any exceptions or forcecloses.

My source code is posted on pastebin.

4

1 回答 1

0

一种方法是通过 URL 连接读取众所周知的站点内容。如果您可以阅读它,那么这意味着您有 Internet 连接。其他是连接到您的广播电台站点:这有双重要求:您有互联网连接并且广播电台站点已启动。

如果您阅读太多,也许它们都会阻止您!

有 android buggy API 可以读取网络状态并吸吮,但是如果您连接到 WIFI,那么即使您的 WAN 电缆拔出,您也会从 API 获得 Connected 状态...

于 2013-03-05T18:59:19.283 回答