禁用蓝牙机器人 [英] disable android bluetooth

查看:145
本文介绍了禁用蓝牙机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有code,使设备上blueooth。

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?

推荐答案

在看看<一个href=\"http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#disable%28%29\"><$c$c>BluetoothAdapter.disable()功能。虽然禁用蓝牙之前,您应该问一个用户。

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

不要忘了旁边的许可添加到您的的Andr​​oidManifest.xml

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

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

这篇关于禁用蓝牙机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆