mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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"
This commit is contained in:
committed by
Manol Donev
parent
a616dbb9bb
commit
1536d15ecf
@@ -4,10 +4,12 @@ export enum connectionType {
|
||||
none = 0,
|
||||
wifi = 1,
|
||||
mobile = 2,
|
||||
ethernet = 3
|
||||
}
|
||||
|
||||
const wifi = "wifi";
|
||||
const mobile = "mobile";
|
||||
const ethernet = "ethernet";
|
||||
|
||||
// Get Connection Type
|
||||
function getConnectivityManager(): android.net.ConnectivityManager {
|
||||
@@ -37,6 +39,10 @@ export function getConnectionType(): number {
|
||||
if (type.indexOf(mobile) !== -1){
|
||||
return connectionType.mobile;
|
||||
}
|
||||
|
||||
if (type.indexOf(ethernet) !== -1){
|
||||
return connectionType.ethernet;
|
||||
}
|
||||
|
||||
return connectionType.none;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@ export enum connectionType {
|
||||
/**
|
||||
* Denotes a mobile connection, i.e. cellular network or WAN.
|
||||
*/
|
||||
mobile = 2
|
||||
mobile = 2,
|
||||
|
||||
/**
|
||||
* Denotes an ethernet connection
|
||||
*/
|
||||
ethernet = 3
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user