【发布时间】:2013-05-21 23:34:25
【问题描述】:
我想从我的安卓服务类中启用禁用蓝牙,我正在使用以下代码
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.enable();
}else{
mBluetoothAdapter.disable();
}
但它不起作用,所以我如何从我的服务类启用/禁用蓝牙以及我需要哪些权限
【问题讨论】:
-
检查但没有解决我的问题
-
您是否遇到任何错误?尝试使用调试器或
Log消息来查看控制流。你可能会注意到它的原因。 -
没有错误只是不工作......
标签: android service permissions bluetooth