我有这样的Android应用程序,需要通过互联网从远程服务器加载数据。此更新-functionaliy显然需要设备不仅可连接到某些类型的网络,但也到互联网。
i have this android application that requires to load data from a remote server via the internet. this update-functionaliy obviously requires the device to not only be connected to some kind of network, but also to the internet.
这样:就是要安排更新服务在一定日期和启动时,它应该确定它是否真正能达到目标服务器上。因此,一个简单的连接到无线网络的设备?不足够了,作为装置可被连接到不提供网络连接的无线网络。像一个PING需要...
so: is want to schedule the update-service to some date and when it starts, it should determine whether it actually CAN reach the target server or not. therefore, a simple "is the device connected to wifi?" does not suffice, as the device may be connected to a wireless network that does not offer internet access. something like a PING is required...
什么最简单的/最好的方法来确定,如果有一个互联网连接,请即服务器可以访问?
whats the easiest / best way to determine, if there is an internet connection is available i.e. server is reachable?
看看这的回答这里计算器。它应该是你正在寻找的地方。
Take a look at this answer here on StackOverflow. It should be just what you are looking for.