Determine the network connection status and network connection
/**
* Determine the network connection status
*/
Public static boolean isNetworkAvailable (Context context ){
ConnectivityManager cwjManager = (ConnectivityManager) context
. GetSystemService (Context. CONNECTIVITY_SERVICE );
NetworkInfo info = cwjManager. getActiveNetworkInfo ();
If (info! = Null & info. isConnected ()){
CustomizedCustomToast. makeText (mContext, "Network Available ",
Toast. LENGTH_LONG). show ();
Return true;
} Else {
CustomizedCustomToast. makeText (mContext, "Network unAvailable ",
Toast. LENGTH_LONG). show ();
Return false;
}
}
Easy language to determine whether the network is connected
Call format: <logical type> connecting to the Internet ()-Application Interface Support library-> Network Communication
English name: IsConnectToInternet
Checks whether the current network status is connected to the Internet. Success returns true; Failure returns false. If this command returns true, you must be able to access the Internet. This command is a basic command.
Operating System Requirements: Windows
Copy and paste the source code. There is no need to upload attachments for two or three sentences of code, or just repeat them by yourself. I hope you can adopt them in time. Thank you !~~
. Version 2
. Supports library eAPI
. Subroutine _ start window _ created
. If the true (reverse (whether it is connected to the Internet () 'check whether there is a network connection, the following message box is displayed, some networks skip this command. If the real command continues executing the code, the program runs normally.
Information Box ("No network connection is detected currently, please check the network and try again", 0,) 'prompt in the information box when no network exists
Terminate () 'terminate the program
. If it really ends
How can I determine whether the network is connected in easy language?
. Version 2
. Subroutine 1
. Local variable in_parameter, short Integer type
. If it is true (InternetGetConnectedState (Bureau _ parameter, 0 ))
Debug output (Bureau _ parameter)
Yes. The first parameter is in the out type, and the variable format is required,
Add a judgment. If the value is 0, the network is connected. If the value is not 0, the network is disconnected.
In fact, this does not need to call the dll
Easy built-in support library,
Connect to the internet ()
Online or not ()
Another is to use http to read webpages and determine whether the content is blank,