c# - UWP NetworkConnectionChanged Event -
i developing uwp app , need things after lost network connection or device connected again.
is there event firing after connection lost or connected?
i searched www found wp8...
i need uwp on windows 10.
i tried use networkinformation.networkstatuschanged
.
i had same problem too. article (and whole website) has helped me alot: http://windowsapptutorials.com/windows-10/how-to-check-for-network-availability-in-universal-windows-apps/
i hope it's need. problem is, can detect if example wifi or mobile network connected. if connected wifi , pull plug on router won't detect it.
now this:
public static bool isinternetconnected() { var isinternetconnected = false; var connectionprofile = networkinformation.getinternetconnectionprofile(); if (connectionprofile != null) { var connectivitylevel = connectionprofile.getnetworkconnectivitylevel(); isinternetconnected = connectivitylevel == networkconnectivitylevel.internetaccess; } return isinternetconnected; }
i believe method doesn't work in emulator i'm not sure. (currently reinstalling vs15 cant test again).
hopefully you.
Comments
Post a Comment