From f1bef481e69eb378facc4daa0ac3f8281210832b Mon Sep 17 00:00:00 2001 From: Nick Iliev Date: Thu, 9 Aug 2018 10:25:32 +0300 Subject: [PATCH] feat(android): add Bluetooth connectivity type for Android (#6162) * feat(android): add Bluetooth connectivity type for Android * Update connectivity.d.ts --- tns-core-modules/connectivity/connectivity.android.ts | 8 +++++++- tns-core-modules/connectivity/connectivity.d.ts | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tns-core-modules/connectivity/connectivity.android.ts b/tns-core-modules/connectivity/connectivity.android.ts index c7833224e..b2e49d097 100644 --- a/tns-core-modules/connectivity/connectivity.android.ts +++ b/tns-core-modules/connectivity/connectivity.android.ts @@ -4,12 +4,14 @@ export enum connectionType { none = 0, wifi = 1, mobile = 2, - ethernet = 3 + ethernet = 3, + bluetooth = 4 } const wifi = "wifi"; const mobile = "mobile"; const ethernet = "ethernet"; +const bluetooth = "bluetooth"; // Get Connection Type function getConnectivityManager(): android.net.ConnectivityManager { @@ -43,6 +45,10 @@ export function getConnectionType(): number { if (type.indexOf(ethernet) !== -1) { return connectionType.ethernet; } + + if (type.indexOf(bluetooth) !== -1) { + return connectionType.bluetooth; + } return connectionType.none; } diff --git a/tns-core-modules/connectivity/connectivity.d.ts b/tns-core-modules/connectivity/connectivity.d.ts index a4c09c092..a41a68f47 100644 --- a/tns-core-modules/connectivity/connectivity.d.ts +++ b/tns-core-modules/connectivity/connectivity.d.ts @@ -32,7 +32,12 @@ export enum connectionType { /** * Denotes an ethernet connection */ - ethernet = 3 + ethernet = 3, + + /** + * Denotes an bluetooth connection + */ + bluetooth = 4 } /**