Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Open up Bluetooth setting, but in another view

I know that to open up the Bluetooth settings programmatically.

I do something like this:

Intent intentOpenBluetoothSettings = new Intent();
intentOpenBluetoothSettings.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS); 
startActivity(intentOpenBluetoothSettings); 

But doing so will take me to the Bluetooth settings page in the same view/application.

How should I go about if I want the Bluetooth settings page to open up in another view/window/page, outside the application?.

The reason why I want this to be done is so that the user will not confuse the settings page and my app.

Thanks.

Update

I tried doing intentOpenBluetoothSettings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

But no luck in getting it to open in another view.

like image 697
Ben Wong Avatar asked Sep 13 '25 15:09

Ben Wong


1 Answers

There are two ways of requesting for enabling Bluetooth:

intentOpenBluetoothSettings.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);

or

intentOpenBluetoothSettings.setAction(BluetoothAdapter.ACTION_REQUEST_ENABLE);

If none of them suit your needs, then you might rethink your idea.

like image 112
R. Zagórski Avatar answered Sep 16 '25 05:09

R. Zagórski