mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
feat(android): add Bluetooth connectivity type for Android (#6162)
* feat(android): add Bluetooth connectivity type for Android * Update connectivity.d.ts
This commit is contained in:

committed by
Alexander Vakrilov

parent
106d417365
commit
f1bef481e6
@ -4,12 +4,14 @@ export enum connectionType {
|
|||||||
none = 0,
|
none = 0,
|
||||||
wifi = 1,
|
wifi = 1,
|
||||||
mobile = 2,
|
mobile = 2,
|
||||||
ethernet = 3
|
ethernet = 3,
|
||||||
|
bluetooth = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
const wifi = "wifi";
|
const wifi = "wifi";
|
||||||
const mobile = "mobile";
|
const mobile = "mobile";
|
||||||
const ethernet = "ethernet";
|
const ethernet = "ethernet";
|
||||||
|
const bluetooth = "bluetooth";
|
||||||
|
|
||||||
// Get Connection Type
|
// Get Connection Type
|
||||||
function getConnectivityManager(): android.net.ConnectivityManager {
|
function getConnectivityManager(): android.net.ConnectivityManager {
|
||||||
@ -43,6 +45,10 @@ export function getConnectionType(): number {
|
|||||||
if (type.indexOf(ethernet) !== -1) {
|
if (type.indexOf(ethernet) !== -1) {
|
||||||
return connectionType.ethernet;
|
return connectionType.ethernet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type.indexOf(bluetooth) !== -1) {
|
||||||
|
return connectionType.bluetooth;
|
||||||
|
}
|
||||||
|
|
||||||
return connectionType.none;
|
return connectionType.none;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,12 @@ export enum connectionType {
|
|||||||
/**
|
/**
|
||||||
* Denotes an ethernet connection
|
* Denotes an ethernet connection
|
||||||
*/
|
*/
|
||||||
ethernet = 3
|
ethernet = 3,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Denotes an bluetooth connection
|
||||||
|
*/
|
||||||
|
bluetooth = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user