I am learning Xamarin,
I would like to know if there is another way to check internet connection.
I Have used CrossConnectivity.Current.IsConnected
from the plugin https://www.nuget.org/packages/Xam.Plugin.Connectivity but it is not worked when I put my wifi off
I have also used Xamarin.Essentails but still not working..
private bool CheckInternet()
{
var current = Connectivity.NetworkAccess;
if (current == NetworkAccess.Internet) return true;
else return false;
}
Thanks for your help
Checkout full documentation link
You can use
public async Task<string> MakeWebRequest()
{
if(!CrossConnectivity.Current.IsConnected)
{
//You are offline, notify the user
return null;
}
//Make web request here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.