相关疑难解决方法(0)

如何在android中以编程方式启用/禁用蓝牙

大家好,

我想通过程序启用/禁用蓝牙..我有以下代码.

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();    
if (!mBluetoothAdapter.isEnabled()) {
        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
Run Code Online (Sandbox Code Playgroud)

但是这种代码在SDK 1.5中不起作用.我怎么能在SDK 1.5中做同样的事情.

android bluetooth

101
推荐指数
5
解决办法
16万
查看次数

从文档中启用Android蓝牙

我正在尝试使用Android 2.0.1 SDK启用蓝牙功能,我正在使用以下文档中的一些代码:http://developer.android.com/guide/topics/wireless/bluetooth.html

这是:

if (!mBluetoothAdapter.isEnabled()) {
    Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
Run Code Online (Sandbox Code Playgroud)

我在REQUEST_ENABLE_BT部分遇到错误,Eclipse说它无法解析.我究竟做错了什么?

android bluetooth

12
推荐指数
1
解决办法
2万
查看次数

显示Android蓝牙设备名称

如何在android中使用Java显示蓝牙设备名称?我可以参考的任何代码?

java eclipse android bluetooth device-name

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×3

bluetooth ×3

device-name ×1

eclipse ×1

java ×1