Skip to content

Commit 1536d15

Browse files
crowebirdmanoldonev
authored andcommitted
fix(android-connectivity): add ethernet connection type (#5670)
Add "ethernet" connection type to getConnectionType to correctly return a connection type when the type is "ethernet"
1 parent a616dbb commit 1536d15

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

tns-core-modules/connectivity/connectivity.android.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ export enum connectionType {
44
none = 0,
55
wifi = 1,
66
mobile = 2,
7+
ethernet = 3
78
}
89

910
const wifi = "wifi";
1011
const mobile = "mobile";
12+
const ethernet = "ethernet";
1113

1214
// Get Connection Type
1315
function getConnectivityManager(): android.net.ConnectivityManager {
@@ -37,6 +39,10 @@ export function getConnectionType(): number {
3739
if (type.indexOf(mobile) !== -1){
3840
return connectionType.mobile;
3941
}
42+
43+
if (type.indexOf(ethernet) !== -1){
44+
return connectionType.ethernet;
45+
}
4046

4147
return connectionType.none;
4248
}

tns-core-modules/connectivity/connectivity.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ export enum connectionType {
2727
/**
2828
* Denotes a mobile connection, i.e. cellular network or WAN.
2929
*/
30-
mobile = 2
30+
mobile = 2,
31+
32+
/**
33+
* Denotes an ethernet connection
34+
*/
35+
ethernet = 3
3136
}
3237

3338
/**

0 commit comments

Comments
 (0)