requestRouteToHost returns false on wifi interface

北城以北 提交于 2019-12-31 02:11:08

问题


public boolean requestRouteToHost (int networkType, int hostAddress)

This method in ConnectivityManager if used with networkType set to wifi interface always returns false.

requestRouteToHost android says it was never implemented for the wifi interface.

Even InetAddress.isReachable() always returns false for publicservers like google.com, java.com

Is there any specific reason why they fail? The only way I could test if there was connectivity was by executing the "ping" by using runtime exec().


回答1:


Apparently this is a bug and this has been raised.




回答2:


This appears to be fixed in ICS. My 2.3 Desire fails in the same way, but my 4.0.4 SGS2 gets a successful true result from requestRouteToHost over WiFi.



来源:https://stackoverflow.com/questions/8322481/requestroutetohost-returns-false-on-wifi-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!