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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论