public String getDebugServerHost() { // Check host setting first. If empty try to detect emulator type and use default // hostname for those String hostFromSettings = mPreferences.getString(PREFS_DEBUG_SERVER_HOST_KEY, null); if (!TextUtils.isEmpty(hostFromSettings)) { return Assertions.assertNotNull(hostFromSettings); } String host = AndroidInfoHelpers.getServerHost(); if (host.equals(AndroidInfoHelpers.DEVICE_LOCALHOST)) { FLog.w( TAG, "You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' " + "to forward the debug server's port to the device."); } return host; }
/** * @return the host to use when connecting to the bundle server. */ private String getDebugServerHost() { // Check debug server host setting first. If empty try to detect emulator type and use default // hostname for those String hostFromSettings = mSettings.getDebugServerHost(); if (!TextUtils.isEmpty(hostFromSettings)) { return Assertions.assertNotNull(hostFromSettings); } String host = AndroidInfoHelpers.getServerHost(); if (host.equals(AndroidInfoHelpers.DEVICE_LOCALHOST)) { FLog.w( ReactConstants.TAG, "You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' " + "to forward the debug server's port to the device."); } return host; }
public String getInspectorDeviceUrl() { return String.format( Locale.US, INSPECTOR_DEVICE_URL_FORMAT, mSettings.getPackagerConnectionSettings().getDebugServerHost(), AndroidInfoHelpers.getFriendlyDeviceName()); }
public JSPackagerClient(String clientId, PackagerConnectionSettings settings, Map<String, RequestHandler> requestHandlers) { super(); Uri.Builder builder = new Uri.Builder(); builder.scheme("ws") .encodedAuthority(settings.getDebugServerHost()) .appendPath("message") .appendQueryParameter("device", AndroidInfoHelpers.getFriendlyDeviceName()) .appendQueryParameter("app", settings.getPackageName()) .appendQueryParameter("clientid", clientId); String url = builder.build().toString(); mWebSocket = new ReconnectingWebSocket(url, this); mRequestHandlers = requestHandlers; }
/** * @return the host to use when connecting to the bundle server from the host itself. */ private static String getHostForJSProxy() { return AndroidInfoHelpers.DEVICE_LOCALHOST; }