问题描述
大家好,
我想启用通过program..I /关闭蓝牙具有以下code。
I want to enable/disable bluetooth through the program..I has the following code.
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
不过,这样的code不是工作在SDK 1.5..How我可以做同样的SDK 1.5。?
But this sort of code is not working in SDK 1.5..How can i do the same in SDK 1.5.?
推荐答案
Android的BluetoothAdapter文档说,因为API级别5 API级别就已经包括了5 是Android 2.0的。
Android BluetoothAdapter docs say it has been available since API Level 5. API Level 5 is Android 2.0.
您可以尝试使用蓝牙API的一个补丁包(还没有尝试过亲自):<一href="http://$c$c.google.com/p/backport-android-bluetooth/">http://$c$c.google.com/p/backport-android-bluetooth/
You can try using a backport of the Bluetooth API (have not tried it personally): http://code.google.com/p/backport-android-bluetooth/
这篇关于如何启用/ android的编程方式禁用蓝牙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!