I have to check internet connection in my application, fallowing this answer
I have added lines to my manifest file. However I have an issue with getSystemServiceMethod
it is not defined in my case, context does not contain such a method.
As well I`ve been trying to do something like this:
public static bool isInternetOn()
{
ConnectivityManager connectivityManager = (ConnectivityManager)Context.ConnectivityService;
NetworkInfo networkInfo = connectivityManager.ActiveNetworkInfo;
bool isWifi = networkInfo.Type == ConnectivityType.Wifi; // wifi check
return networkInfo.IsConnected;
}
But it throws an exception. How could I fix this issue and check whether the phone has access to the internet.