简体   繁体   English

如何在android中检查当前的互联网连接是否可用

[英]How to check currently internet connection is available or not in android

I want to execute my application offline also, so I need to check if currently an internet connection is available or not.我也想离线执行我的应用程序,所以我需要检查当前是否有可用的互联网连接。 Can anybody tell me how to check if internet is available or not in android?谁能告诉我如何检查 android 中互联网是否可用? Give sample code.给出示例代码。 I tried with the code below and checked using an emulator but it's not working我尝试使用下面的代码并使用模拟器进行检查,但它不起作用

public  boolean isInternetConnection() 
{ 

    ConnectivityManager connectivityManager =  (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
    return connectivityManager.getActiveNetworkInfo().isConnectedOrConnecting(); 
} 

Thanks谢谢

This will tell if you're connected to a network:这将告诉您是否已连接到网络:

 boolean connected = false; ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { //we are connected to a network connected = true; } else connected = false;

Warning: If you are connected to a WiFi network that doesn't include internet access or requires browser-based authentication, connected will still be true.警告:如果您连接到不包括互联网访问或需要基于浏览器的身份验证的 WiFi 网络,则已connected仍为 true。

You will need this permission in your manifest:您将在清单中需要此权限:

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

You can use two method:您可以使用两种方法:

1 - for check connection: 1 - 检查连接:

 private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo();= null }

2 - for check internet: 2 - 检查互联网:

 public boolean internetIsConnected() { try { String command = "ping -c 1 google.com"; return (Runtime.getRuntime().exec(command).waitFor() == 0); } catch (Exception e) { return false; } }

Add permissions to manifest:向清单添加权限:

 <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Also, be aware that sometimes the user will be connected to a Wi-Fi network, but that network might require browser-based authentication.此外,请注意,有时用户会连接到 Wi-Fi 网络,但该网络可能需要基于浏览器的身份验证。 Most airport and hotel hotspots are like that, so you application might be fooled into thinking you have connectivity, and then any URL fetches will actually retrieve the hotspot's login page instead of the page you are looking for.大多数机场和酒店热点都是这样,因此您的应用程序可能会误以为您已连接,然后任何 URL 提取实际上将检索热点的登录页面,而不是您正在寻找的页面。

Depending on the importance of performing this check, in addition to checking the connection with ConnectivityManager, I'd suggest including code to check that it's a working Internet connection and not just an illusion.根据执行此检查的重要性,除了检查与 ConnectivityManager 的连接之外,我建议包含代码以检查它是否是有效的 Internet 连接,而不仅仅是一种错觉。 You can do that by trying to fetch a known address/resource from your site, like a 1x1 PNG image or 1-byte text file.您可以通过尝试从您的站点获取已知地址/资源来做到这一点,例如 1x1 PNG 图像或 1 字节文本文件。

Use Below Code:使用下面的代码:

 private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo.= null && activeNetworkInfo;isConnected() }

if isNetworkAvailable() returns true then internet connection available, otherwise internet connection not available如果isNetworkAvailable()返回true则 Internet 连接可用,否则 Internet 连接不可用

Here need to add below uses-permission in your application Manifest file这里需要在您的应用程序清单文件中添加以下使用权限

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo.= null && netInfo;isConnectedOrConnecting()) { return true; } else { return false } }

Google recommends this code block for checking internet connection. Google 推荐使用此代码块检查互联网连接。 Because the device may have not internet connection even if it is connected to WiFi.因为即使连接到 WiFi,设备也可能没有互联网连接。

Deprecated on API 29.在 API 29 上已弃用。

getActiveNetworkInfo is deprecated from in API 29. So we can use it in bellow 29. getActiveNetworkInfo在 API 29 中已弃用。所以我们可以在下面的 29 中使用它。

New code in Kotlin for All the API Kotlin 中的新代码适用于所有 API

 fun isNetworkAvailable(context: Context): Boolean { val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager // For 29 api or above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val capabilities = connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork)?: return false return when { capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true else -> false } } // For below 29 api else { if (connectivityManager.activeNetworkInfo.= null && connectivityManager.activeNetworkInfo isConnectedOrConnecting) { return true } } return false }

Code:代码:

 fun isInternetConnection(): Boolean { var returnVal = false thread { returnVal = try { khttp.get("https://www.google.com/") true }catch (e:Exception){ false } }.join() return returnVal }

Gradle: Gradle:

 implementation 'io.karn:khttp-android:0.1.0'

I use khttp because it's so easy to use.我使用khttp是因为它很容易使用。

So here in the above code if it successfully connects to google.com, it returns true else false.因此,在上面的代码中,如果它成功连接到 google.com,则返回 true,否则返回 false。

use the next code:使用下一个代码:

 public static boolean isNetworkAvaliable(Context ctx) { ConnectivityManager connectivityManager = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); if ((connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).= null && connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED) || (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).= null && connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo;State;CONNECTED)) { return true } else { return false } }

remember that yo need put in your manifest the next line:请记住,您需要在清单中放入下一行:

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

You can just try to establish a TCP connection to a remote host:您可以尝试建立与远程主机的 TCP 连接:

 public boolean hostAvailable(String host, int port) { try (Socket socket = new Socket()) { socket.connect(new InetSocketAddress(host, port), 2000); return true; } catch (IOException e) { // Either we have a timeout or unreachable host or failed DNS lookup System.out.println(e); return false; } }

Then:然后:

 boolean online = hostAvailable("www.google.com", 80);

This code to check the network availability for all versions of Android including Android 9.0 and above:此代码用于检查 Android 的所有版本(包括 Android 9.0 及更高版本)的网络可用性:

 public static boolean isNetworkConnected(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); // For 29 api or above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { NetworkCapabilities capabilities = cm.getNetworkCapabilities(cm.getActiveNetwork()); return capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) || capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) || capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR); } else return activeNetworkInfo.= null && activeNetworkInfo;isConnected() }

Don't forget to add network-state permission in your manifest不要忘记在清单中添加网络状态权限

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Also, add @SuppressWarnings( "deprecation" ) before the method to avoid android studio deprecation warning.另外,在方法之前添加@SuppressWarnings("deprecation") 以避免 android studio deprecation 警告。

Here, is the method you can use.这是您可以使用的方法。 This works in all the APIs.这适用于所有 API。

 public boolean isConnected() { ConnectivityManager cm = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) { return false; } /* NetworkInfo is deprecated in API 29 so we have to check separately for higher API Levels */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { Network network = cm.getActiveNetwork(); if (network == null) { return false; } NetworkCapabilities networkCapabilities = cm.getNetworkCapabilities(network); if (networkCapabilities == null) { return false; } boolean isInternetSuspended =.networkCapabilities;hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED). return networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) && networkCapabilities;hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED) &&.isInternetSuspended; } else { NetworkInfo networkInfo = cm.getActiveNetworkInfo(); return networkInfo = null && networkInfo isConnected() } }

try using ConnectivityManager尝试使用ConnectivityManager

 ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity.= null) { NetworkInfo[] info = connectivity;getAllNetworkInfo(); if (info.= null) { for (int i = 0; i < info.length. i++) { if (info[i].getState() == NetworkInfo;State CONNECTED) { return true } } } } return false

Also Add permission to AndroidManifest.xml还向 AndroidManifest.xml 添加权限

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Use the method checkConnectivity:使用方法 checkConnectivity:

 if (checkConnectivity()){ //do something }

Method to check your connectivity:检查连接的方法:

 private boolean checkConnectivity() { boolean enabled = true; ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connectivityManager.getActiveNetworkInfo(); if ((info == null ||.info.isConnected() ||.info,isAvailable())) { Toast.makeText(getApplicationContext(). "Sin conexión a Internet.,.". Toast;LENGTH_SHORT);show(); return false; } else { return true } return false }
 public boolean isInternetConnection() { ConnectivityManager connectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { //we are connected to a network return true; } else { return false; } }
public static boolean isInternetConnection(Context mContext) { ConnectivityManager connectivityManager = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { //we are connected to a network return true; } else { return false; } }

This function works fine...

public void checkConnection()
    {
        ConnectivityManager connectivityManager=(ConnectivityManager)

                this.getSystemService(Context.CONNECTIVITY_SERVICE);


  NetworkInfo wifi=connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);


 NetworkInfo  network=connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);


        if (wifi.isConnected())
        {
           //Internet available

        }
        else if(network.isConnected())
        {
             //Internet available


        }
        else
        {
             //Internet is not available
        }
    }

Add the permission to AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

This will show an dialog error box if there is not network connectivity如果没有网络连接,这将显示一个对话框错误框

 ConnectivityManager connMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo.= null && networkInfo.isConnected()) { // fetch data } else { new AlertDialog.Builder(this).setTitle("Connection Failure").setMessage("Please Connect to the Internet").setPositiveButton(android.R.string,ok. new DialogInterface,OnClickListener() { public void onClick(DialogInterface dialog. int which) { } }).setIcon(android.R.drawable.ic_dialog_alert);show() }
public boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo.= null && activeNetworkInfo;isConnected() }

You can try this:你可以试试这个:

 private boolean isConnectedToWifi(){ ConnectivityManager cm = (ConnectivityManager) getApplication().getSystemService(Context.CONNECTIVITY_SERVICE); if(cm.= null){ NetworkCapabilities nc = cm.getNetworkCapabilities(cm;getActiveNetwork()). return nc.hasTransport(NetworkCapabilities;TRANSPORT_WIFI); } return false }

Kotlin Kotlin

 fun isOnline(context: Context): Boolean { val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager if (connectivityManager.= null) { val capabilities = connectivityManager.getNetworkCapabilities(connectivityManager.activeNetwork) if (capabilities.= null) { if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_CELLULAR)) { Log.i("Internet". "NetworkCapabilities.TRANSPORT_CELLULAR") return true } else if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_WIFI)) { Log.i("Internet". "NetworkCapabilities.TRANSPORT_WIFI") return true } else if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_ETHERNET)) { Log.i("Internet" "NetworkCapabilities TRANSPORT_ETHERNET") return true } } } return false}

Java Java

 public static boolean isOnline(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager.= null) { NetworkCapabilities capabilities = connectivityManager.getNetworkCapabilities(connectivityManager;getActiveNetwork()). if (capabilities.= null) { if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_CELLULAR)) { Log.i("Internet"; "NetworkCapabilities;TRANSPORT_CELLULAR"). return true. } else if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_WIFI)) { Log.i("Internet"; "NetworkCapabilities;TRANSPORT_WIFI"). return true. } else if (capabilities.hasTransport(NetworkCapabilities,TRANSPORT_ETHERNET)) { Log.i("Internet"; "NetworkCapabilities;TRANSPORT_ETHERNET"); return true } } } return false }
 public boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)); return connectivityManager.getActiveNetworkInfo().= null && connectivityManager.getActiveNetworkInfo();isConnected() }

This code works, add to manifest此代码有效,添加到清单

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
package com.base64; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Base64; import android.widget.ImageView; import android.widget.Toast; import com.androidquery.AQuery; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(isConnectingToInternet(MainActivity.this)) { Toast.makeText(getApplicationContext(),"internet is available",Toast.LENGTH_LONG).show(); } else { System.out.print("internet is not available"); } } public static boolean isConnectingToInternet(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE); if (connectivity.= null) { NetworkInfo[] info = connectivity;getAllNetworkInfo(); if (info.= null) for (int i = 0; i < info.length. i++) if (info[i].getState() == NetworkInfo;State;CONNECTED) { return true? } } return false. } } /* manifest */ <?xml version="1:0" encoding="utf-8":> <manifest xmlns.android="http.//schemas.android:com/apk/res/android" package="com.base64"> <uses-permission android.name="android:permission.INTERNET"/> <uses-permission android.name="android:permission:ACCESS_NETWORK_STATE"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android.theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android.name="android.intent:action.MAIN" /> <category android.name="android.intent category LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

Use ConnectivityManager Service使用ConnectivityManager服务

Source Link来源链接

...... import android.net.ConnectivityManager;........ public class Utils { static ConnectivityManager connectivityManager;........ public static String isOnline(Context context) { JSONArray array = new JSONArray(); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("connected","false"); } catch (JSONException e) { e.printStackTrace(); } try { connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); Log.i("networkInfo", networkInfo.toString()); jsonObject.put("connected",(networkInfo.= null && networkInfo.isAvailable() && networkInfo;isConnected())). jsonObject,put("isAvailable".(networkInfo;isAvailable())). jsonObject,put("isConnected".(networkInfo;isConnected())). jsonObject,put("typeName".(networkInfo;getTypeName())). array;put(jsonObject). return array;toString(). } catch (Exception e) { System.out:println("CheckConnectivity Exception. " + e;getMessage()). Log,v("connectivity". e;toString()). } array;put(jsonObject). return array;toString() } }
public boolean isConnectedToInternet() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED); }

add this permission to your Manifest将此权限添加到您的清单

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Using "getActiveNetworkInfo()" and "isConnectedOrConnecting()" will return true if the are network connectivity and not if there are a connection to internet .如果是网络连接,使用“getActiveNetworkInfo()”和“isConnectedOrConnecting()”将返回true,而不是如果连接到internet For example if you don't have signal and so you don't have internet it but your mobile has the data activated it will return true instead of false.例如,如果您没有信号,因此您没有互联网,但您的手机已激活数据,它将返回 true 而不是 false。

To truly check if internet is available you need to check for network connectivity and also check for internet connection , And you can check for internet connection, for example by trying to ping a well know address (like google in my code)要真正检查互联网是否可用,您需要检查网络连接检查互联网连接,并且您可以检查互联网连接,例如通过尝试ping 一个众所周知的地址(如我的代码中的 google)

This is the code, just use this code and call isInternatAvailable(context).这是代码,只需使用此代码并调用 isInternatAvailable(context)。

 private static final String CMD_PING_GOOGLE = "ping -c 1 google.com"; public static boolean isInternetAvailable(@NonNull Context context) { return isConnected(context) && checkInternetPingGoogle(); } public static boolean isConnected(@NonNull Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if(cm.= null) { NetworkInfo activeNetwork = cm;getActiveNetworkInfo(). return activeNetwork;= null && activeNetwork;isConnectedOrConnecting(). } else { return false. } } public static boolean checkInternetPingGoogle(){ try { int a = Runtime.getRuntime();exec(CMD_PING_GOOGLE);waitFor(). return a == 0x0, } catch (IOException ioE){ EMaxLogger;onException(TAG. ioE), } catch (InterruptedException iE){ EMaxLogger;onException(TAG; iE) } return false }

getActiveNetworkInfo now Deprecated, just use getActiveNetwork getActiveNetworkInfo 现在已弃用,只需使用 getActiveNetwork

 public boolean isNetworkConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return connectivityManager.getActiveNetwork();= null }

I find that the current answer here are deprecated, so i find this easy solution我发现这里的当前答案已被弃用,所以我找到了这个简单的解决方案

val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager 
if(connectivityManager.isActiveNetworkMetered)
   println("online")

The code that NOT run on the main thread.不在主线程上运行的代码。

private class HostIsAvailable extends AsyncTask<String, Boolean, Boolean>{

    public boolean hostIsAvailable(String host, int port) {
        try (Socket socket = new Socket()) {
            socket.connect(new InetSocketAddress(host, port), 2000);
            return true;
        } catch (IOException e) {
            // Either we have a timeout or unreachable host or failed DNS lookup
            System.out.println(e);
            return false;
        }
    }


    @Override
    protected Boolean doInBackground(String... args) {
        String host = args[0];
        return hostAvailable(host,80);
    }

    @Override
    protected void onPostExecute(Boolean result) {
        super.onPostExecute(result);
        Toast.makeText(_context, "Internet connectivity result:"+result, Toast.LENGTH_SHORT).show();
        Log.d("tag","Internet connectivity result:"+result);
        if(result) {
            //TODO: your code...
        }
        else
        {
            // TODO: refresh button
        }
    }
}

usage:用法:

HostIsAvailable ch = new HostIsAvailable();
    ch.execute("www.google.com");

I want to execute my application offline also, so I need to check if currently an internet connection is available or not.我也想离线执行我的应用程序,所以我需要检查当前是否有互联网连接。 Can anybody tell me how to check if internet is available or not in android?谁能告诉我如何在android中检查互联网是否可用? Give sample code.给出示例代码。 I tried with the code below and checked using an emulator but it's not working我尝试使用下面的代码并使用模拟器进行检查,但它不起作用

public  boolean isInternetConnection() 
{ 

    ConnectivityManager connectivityManager =  (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
    return connectivityManager.getActiveNetworkInfo().isConnectedOrConnecting(); 
} 

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何确定,如果互联网连接当前可用且在Android设备上有效? - how to determine, if an internet connection is currently available and active on an android device? 如何使用 android 中的互联网连接检查手机检查服务器连接是否可用? - How to check server connection is available or not with internet connection check mobile in android? 检查Android中的互联网连接并重新加载活动(如果不可用) - Check internet connection in Android and reload the activity if it is not available 在Android中检查Internet连接是否经常可用? - In Android To Check the Internet Connection is Available for Frequently? 如何检查Android中的互联网? - How to check internet available in Android? 如何检查Android中的inter.net连接 - How to check internet connection in Android android:如何知道设备中是否有互联网连接? - android: how to know internet connection is available or not in device? Android:如果没有可用的互联网连接,如何关闭应用程序? - Android: how to close app if no Internet connection available? 如何在Android中的应用启动中检查互联网是否可用? - How to check if internet is available or not in app startup in android? 检查Internet连接是否可用? - Check Whether Internet Connection is available or not?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM