自己写android代码,能找到其他蓝牙设备但是找不到cc2541蓝牙模块,新手求大神指导

aw298tr 2016-02-26 01:57:04
BluetoothAdapter badapter = BluetoothAdapter.getDefaultAdapter();
if(badapter != null ){
System.out.println("本机拥有蓝牙设备");
if(badapter.isEnabled()){
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivity(intent);
}
Set<BluetoothDevice> devise =badapter.getBondedDevices();
if(devise.size()>0){
for (Iterator iterator =devise.iterator();iterator.hasNext();){
BluetoothDevice bluetoothDevice = (BluetoothDevice) iterator.next();
System.out.println(bluetoothDevice.getName());
System.out.println(bluetoothDevice.getAddress());
}
}

}
else{
System.out.println("没有蓝牙设备");
}

///////////////////////////////////////////////////////
02-26 13:27:54.414 18241-18241/com.example.zj.z I/System.out﹕ 本机拥有蓝牙设备
02-26 13:27:54.444 18241-18241/com.example.zj.z I/System.out﹕ SCH-i929
02-26 13:27:54.444 18241-18241/com.example.zj.z I/System.out﹕ 04:FE:31:64:5C:DF
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ V9180
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ 98:6C:F5:B7:32:C1
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ GT-I9103
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ 6C:83:36:FE:D5:41
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ GT-S5820
02-26 13:27:54.454 18241-18241/com.example.zj.z I/System.out﹕ BC:B1:F3:E1:3C:C6
02-26 13:27:54.464 18241-18241/com.example.zj.z I/System.out﹕ HUAWEI NXT-AL10
02-26 13:27:54.464 18241-18241/com.example.zj.z I/System.out﹕ 48:DB:50:2A:64:3C
02-26 13:31:52.364 18241-18247/com.example.zj.z D/dalvikvm﹕ GC_FOR_ALLOC freed 494K, 47% free 5086K/9468K, paused 167ms, total 191ms
////

但是用网上的程序能搜到:CC41-A
00:15:83:00:61:6E

...全文
277 1 打赏 收藏 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
莫淡定 2016-03-16
  • 打赏
  • 举报
回复
楼主,没看明白你的代码是做什么的,你贴的代码只是将在配对列表里的设备打印了一边,如果cc2541 没有在配对列表,肯定找不到. Set<BluetoothDevice> devise =badapter.getBondedDevices();//获取已经配对的设备

80,490

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧