mirror of
https://gitee.com/shuto/cordova-plugin-network-information.git
synced 2025-03-15 12:51:00 +08:00
CB-8384 Fixes the way we detect online status on Windows
This commit is contained in:
parent
c828153516
commit
d8a714757f
@ -43,11 +43,13 @@ module.exports = {
|
|||||||
var conLevel = profile.getNetworkConnectivityLevel();
|
var conLevel = profile.getNetworkConnectivityLevel();
|
||||||
var interfaceType = profile.networkAdapter.ianaInterfaceType;
|
var interfaceType = profile.networkAdapter.ianaInterfaceType;
|
||||||
|
|
||||||
if (conLevel == Windows.Networking.Connectivity.NetworkConnectivityLevel.none) {
|
// since we use this to detect whether we are online or offline we do check agains InternetAccess
|
||||||
|
// localAccess (airplane mode as an example) or constrainedInternetAccess mean there is no access to the internet available
|
||||||
|
// https://msdn.microsoft.com/library/windows/apps/windows.networking.connectivity.networkconnectivitylevel.aspx
|
||||||
|
if (conLevel != Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess) {
|
||||||
connectionType = Connection.NONE;
|
connectionType = Connection.NONE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.connectivity.networkadapter.ianainterfacetype
|
|
||||||
switch (interfaceType) {
|
switch (interfaceType) {
|
||||||
case 71:
|
case 71:
|
||||||
connectionType = Connection.WIFI;
|
connectionType = Connection.WIFI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user