Skip to content

Commit

Permalink
Merge pull request #9 from rafaelterada/patch-1
Browse files Browse the repository at this point in the history
Added "openSettings", which opens the bluetooth settings screen
  • Loading branch information
edufolly authored Dec 20, 2018
2 parents 5fcde65 + a5cab4b commit 09ab5ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ public void onMethodCall(MethodCall call, Result result) {
case "isConnected":
result.success(THREAD != null);
break;

case "openSettings":
ContextCompat.startActivity(registrar.activity(),
new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS),
null);
result.success(true);
break;

case "getBondedDevices":
try {
Expand Down
3 changes: 3 additions & 0 deletions lib/flutter_bluetooth_serial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class FlutterBluetoothSerial {

Future<bool> get isConnected async =>
await _channel.invokeMethod('isConnected');

Future<bool> get openSettings async =>
await _channel.invokeMethod('openSettings');

Future<List> getBondedDevices() async {
final List list = await _channel.invokeMethod('getBondedDevices');
Expand Down

0 comments on commit 09ab5ff

Please sign in to comment.