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?
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"/>
I managed to use .disable
and .enable
with the BLUETOOTH_ADMIN
permission.
精彩评论