Reputation: 147
I have a little problem with the VS (Visual Studio) Android Emulator. The Emulator it self has internet connection. I can Brows and everything.
The Problem is the emulator and the Xamarin.Forms app.
i testet this on the Emulator:
var current = Connectivity.NetworkAccess;
if (current != NetworkAccess.Internet)
{
//TODO: Fehlermeldung wegen keinem Internet
return;
}
var isReachable = await CrossConnectivity.Current.IsReachable("google.com", 5000);
isReachable is false on the emulator but true when i test it with a real device. what could the problem be?
Upvotes: 0
Views: 279
Reputation: 14473
Android Emulator shares the same network in local computer.
So first make sure that Google
is accessible from local broswer .
Then try IsRemoteReachable
instead of IsReachable
.
Check https://jamesmontemagno.github.io/ConnectivityPlugin/PingaHost.html.
Upvotes: 1