Android BLE开发记录

2 篇文章 0 订阅
1 篇文章 0 订阅

2014-08-11

今天Nexus到了,终于可以开始搞Android BLE开发了,好激动,今晚先看看官方API吧。API地址:http://developer.android.com/guide/topics/connectivity/bluetooth-le.html


2014-8-13

修改了一个网上找的DEMO,可以使手机搜索到iBeacon基站,实时显示信号强度。但是我使用的是递归调用循环搜索,有个很大的问题是搜索功耗很高。Google是这么说的

To find BLE devices, you use the startLeScan() method. This method takes aBluetoothAdapter.LeScanCallback as a parameter. You must implement this callback, because that is how scan results are returned. Because scanning is battery-intensive, you should observe the following guidelines:

  • As soon as you find the desired device, stop scanning.
  • Never scan on a loop, and set a time limit on your scan. A device that was previously available may have moved out of range, and continuing to scan drains the battery.
但是不使用loop循环搜索怎么实时搜到广播呢?难道要用户自己打开/关闭搜索?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值