Himberjack
Himberjack

Reputation: 5792

disable android bluetooth

I have the code that enables the blueooth on a device.

Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, 1);

I am wondering how can I disable it?

Upvotes: 1

Views: 561

Answers (2)

Himberjack
Himberjack

Reputation: 5792

I managed to use .disable and .enable with the BLUETOOTH_ADMIN permission.

Upvotes: 0

inazaruk
inazaruk

Reputation: 74780

Take a look at BluetoothAdapter.disable() function. You should ask a user before disabling bluetooth though.

Don't forget to add next permission to your AndroidManifest.xml :

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Upvotes: 8

Related Questions