FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(android): add Bluetooth connectivity type for Android (#6162) · NativeScript/NativeScript@f1bef48 · GitHub

Commit f1bef48

Browse files
authored andcommitted
feat(android): add Bluetooth connectivity type for Android (#6162)
* feat(android): add Bluetooth connectivity type for Android * Update connectivity.d.ts
1 parent 106d417 commit f1bef48

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ export enum connectionType {
44
none = 0,
55
wifi = 1,
66
mobile = 2,
7-
ethernet = 3
7+
ethernet = 3,
8+
bluetooth = 4
89
}
910

1011
const wifi = "wifi";
1112
const mobile = "mobile";
1213
const ethernet = "ethernet";
14+
const bluetooth = "bluetooth";
1315

1416
// Get Connection Type
1517
function getConnectivityManager(): android.net.ConnectivityManager {
@@ -43,6 +45,10 @@ export function getConnectionType(): number {
4345
if (type.indexOf(ethernet) !== -1) {
4446
return connectionType.ethernet;
4547
}
48+
49+
if (type.indexOf(bluetooth) !== -1) {
50+
return connectionType.bluetooth;
51+
}
4652

4753
return connectionType.none;
4854
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ export enum connectionType {
3232
/**
3333
* Denotes an ethernet connection
3434
*/
35-
ethernet = 3
35+
ethernet = 3,
36+
37+
/**
38+
* Denotes an bluetooth connection
39+
*/
40+
bluetooth = 4
3641
}
3742

3843
/**

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL