On Jul 20, 6:58 pm, Tina <[email protected]> wrote: > Hi, all! > I need to check web site availability and use requestRouteToHost for > that purpose. On real device everything works fine, but on emulator > requestRouteToHost always return "false". > What's wrong? > Code is: > > public static boolean isHostAvailable(Context context, String > urlString) throws UnknownHostException, MalformedURLException { > boolean ret = false; > int networkType = ConnectivityManager.TYPE_WIFI;/******LINE > 1******/ > ConnectivityManager cm = (ConnectivityManager) > context.getSystemService(Context.CONNECTIVITY_SERVICE); > if(cm != null){ > NetworkInfo nf = cm.getActiveNetworkInfo(); > if(nf != null){ > networkType = nf.getType(); > } > URL url = new URL(urlString); > InetAddress iAddress = > InetAddress.getByName(url.getHost()); > ret = cm.requestRouteToHost(networkType, > ipToInt(iAddress.getHostAddress())); > } > return ret; > > } > >
i dont think wi-fi access is possible on emulator. so make sure and if not possible,try with other network types. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

