Android 应用程序在 Reliance JIO 4G 连接中运行不频繁

ind*_*gga 6 api error-handling performance android

我有一个 Android 应用程序,在除 Reliance Jio 之外的所有运营商的 WiFi 和 3G 连接中都可以正常工作。

但是,我发现有时,当使用 Reliance JIO 4G 连接时,Android 应用程序无法连接到我的 HTTPS Web 服务,但当设备连接到其他服务时,同一组 HTTPS Web 服务可以完美运行,没有任何延迟提供商。

Jay*_*nth 0

您应该在发出请求之前检查用户是否具有有效的互联网连接。

使用此方法检查互联网可用性,仅在返回 true 时才发出请求,否则,祝他们互联网不可用。

public static boolean isInternetAvailable() {
    try {
        InetAddress ipAddr = InetAddress.getByName("google.com"); //You can replace it with your domain name
        return !ipAddr.equals("");

    } catch (Exception e) {
        return false;
    }

}
Run Code Online (Sandbox Code Playgroud)