From 25c3f03f97e88d2486c38190a7bc5d431b8305ec Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Mon, 27 Nov 2017 01:06:16 -0600 Subject: [PATCH 1/7] Add Android bluetoothSettings() function --- .../java/com/rjblopes/opensettings/OpenSettings.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/src/main/java/com/rjblopes/opensettings/OpenSettings.java b/android/src/main/java/com/rjblopes/opensettings/OpenSettings.java index 15da8af..dd2c0d7 100644 --- a/android/src/main/java/com/rjblopes/opensettings/OpenSettings.java +++ b/android/src/main/java/com/rjblopes/opensettings/OpenSettings.java @@ -55,5 +55,15 @@ public void wifiSettings() { reactContext.startActivity(intent); } } + + @ReactMethod + public void bluetoothSettings() { + Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); + if (intent.resolveActivity(reactContext.getPackageManager()) != null) { + reactContext.startActivity(intent); + } + } //endregion } From d3d43ced8a46c2bffe4d23641a2ba0f83cd96275 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Mon, 27 Nov 2017 01:11:08 -0600 Subject: [PATCH 2/7] Add bluetooth() function to support iOS Bluetooth settings, link Android bluetoothSettings() --- DeviceSettings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/DeviceSettings.js b/DeviceSettings.js index f3086c3..52f91d2 100644 --- a/DeviceSettings.js +++ b/DeviceSettings.js @@ -32,4 +32,14 @@ function wifi(){ } } -module.exports = { open , app, wifi }; +function bluetooth(){ + try{ + (Platform.OS === 'ios') ? + Linking.openURL('App-prefs:root=Bluetooth') : + RNOpenSettings.bluetoothSettings(); + }catch(err){ + console.error(err); + } +} + +module.exports = { open , app, wifi, bluetooth }; From aa13515412c8523c22979c18c4b8ac5a0eaeac2a Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Mon, 27 Nov 2017 01:14:59 -0600 Subject: [PATCH 3/7] Update README with bluetooth() --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index dd76357..1bbb34f 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,10 @@ DeviceSettings.app(); // Open wifi settings menu DeviceSettings.wifi(); + +// Open Bluetooth settings menu +DeviceSettings.bluetooth(); + ``` From 1f677cd3b8722f32102f3a09c5f74725dc82c428 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Mon, 27 Nov 2017 01:22:02 -0600 Subject: [PATCH 4/7] Update app/build.gradle for EG compatibility --- android/build.gradle | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 1adb927..65f164c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,15 +1,10 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" + compileSdkVersion 26 defaultConfig { - minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - + minSdkVersion 18 } lintOptions { warning 'InvalidPackage' From 9f3c5494375a497e6720d68631535526186e0be3 Mon Sep 17 00:00:00 2001 From: Hieu Minh Nguyen Date: Mon, 27 Nov 2017 01:58:48 -0600 Subject: [PATCH 5/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1bbb34f..827e5d2 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ React Native simple platform agnostic API to open up device settings menus ## Install ``` npm install react-native-device-settings --save + +[for Bluetooth settings support] +npm install https://github.com/cheehieu/react-native-device-settings --save ``` ### Automatic Install From 9fdc35574a8bfc2221fef37ed705a7334d71fc82 Mon Sep 17 00:00:00 2001 From: Hieu Minh Nguyen Date: Mon, 27 Nov 2017 02:01:39 -0600 Subject: [PATCH 6/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 827e5d2..e6982e2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ React Native simple platform agnostic API to open up device settings menus ``` npm install react-native-device-settings --save -[for Bluetooth settings support] +// for Bluetooth settings support, while not merged to rjblopes' master npm install https://github.com/cheehieu/react-native-device-settings --save ``` @@ -16,7 +16,7 @@ react-native link react-native-device-settings ``` ### Manual Install -### `iOS` +### iOS -NA: using Linking RN library. URLs applicable for IOS 10. From 7d479bb952a697b18d2a6234995953d5c6dedaa3 Mon Sep 17 00:00:00 2001 From: Hieu Nguyen Date: Mon, 12 Feb 2018 00:43:05 -0600 Subject: [PATCH 7/7] Update README, revert build.gradle, bump version # --- README.md | 6 +++--- android/build.gradle | 9 +++++++-- package.json | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e6982e2..331aa38 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,6 @@ React Native simple platform agnostic API to open up device settings menus ## Install ``` npm install react-native-device-settings --save - -// for Bluetooth settings support, while not merged to rjblopes' master -npm install https://github.com/cheehieu/react-native-device-settings --save ``` ### Automatic Install @@ -65,6 +62,9 @@ DeviceSettings.app(); // Open wifi settings menu DeviceSettings.wifi(); +// Open location settings menu [Android only] +DeviceSettings.location(); + // Open Bluetooth settings menu DeviceSettings.bluetooth(); diff --git a/android/build.gradle b/android/build.gradle index 65f164c..1adb927 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,10 +1,15 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 26 + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { - minSdkVersion 18 + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } lintOptions { warning 'InvalidPackage' diff --git a/package.json b/package.json index 4a0c5f9..54c01f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-device-settings", - "version": "1.2.0", + "version": "1.3.0", "description": "simple platform agnostic API to open device settings menus in react native", "main": "DeviceSettings.js", "scripts": {