boolean resultBool = connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, hostAddress); Log.debug(TAG_LOG, "requestRouteToHost result: " + resultBool); if (!resultBool)
public boolean getRouteToPathExists(final int hostAddress) { return (mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_WIFI, hostAddress) || mConnectionManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE, hostAddress)); } }
private boolean isConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected() && cm.requestRouteToHost(activeNetworkInfo.getType(), yourHostAddress); }
/** * <!-- ================================================================ --> * * @param myServerIPAddress - see http://www.aboutmyip.com/AboutMyXApp/IP2Integer.jsp about how to convert an ip adress into an integer value * @return true, if a connecting can be established */ private boolean isConnectionPossible(final int myServerIPAddress) { boolean isPossible; try { ConnectivityManager cm; cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); isPossible = cm.requestRouteToHost(ni.getType(), myServerIPAddress); if(!isPossible){ for(NetworkInfo info : cm.getAllNetworkInfo() ){ if(info.isAvailable() &&info.isConnected() &&cm.requestRouteToHost(info.getType(), myServerIPAddress)){ isPossible = true; break; } } } } catch (Exception e) { //this is an abbreviation. don't forget to handle exceptions properly isPossible = false; } return isPossible; }
connectionSet = connManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, lookupHost("Video Stored Address"));
boolean resultBool = connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, hostAddress); Log.debug(TAG_LOG, "requestRouteToHost result: " + resultBool); if (!resultBool)