开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜