Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the Bluetooth settings Connect & pair screen using intent?

I want to navigate directly to the bluetooth settings Connect & pair screen on a button click now I can navigate till the wireless settings..

My code is as follows:

Intent i=new Intent();
i.setClassName("com.android.settings","com.android.settings.WirelessSettings");
startActivity(i);
like image 341
inforg Avatar asked Dec 02 '22 02:12

inforg


2 Answers

It's pretty simple, try this:

Intent settingsIntent = new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
startActivity(settingsIntent);
like image 170
Brian Avatar answered Dec 16 '22 17:12

Brian


Use the follwoing:

    Intent settings_intent = new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
    startActivityForResult(settings_intent, 0);

This way you will open Bluetooth settings page and later return back to your activity that started the Intent.

like image 30
abhi Avatar answered Dec 16 '22 15:12

abhi