Can u provide me the simple code for scanning the nearby BLE devices and list it by device name and MAC ID. I tried this using sample code provided in http://developer.android.com/guide/topics/connectivity/bluetooth-le.html. But didn't work, any reference link or ideas since i am new to BLE app.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
This example is based on the developers web you posted and works great for me. This is the code:
DeviceScanActivity.class
}
The custom layout for the Listview
listitem_device.xml
:The progress bar on scanning
actionbar_indeterminate_progress.xml
:The menu layout
main.xml
:The strings layout
strings.xml
:And the manifest
AndroidManifest.xml
:I think this is all. If I missed anything let me now and I fix it. Hope it helps!!
(Bluetooth LE quite sucks in Android yet :D... needs and update fast!)
UPDATE:
Download here a full example of BLE scan and connection: https://dl.dropboxusercontent.com/u/18548987/DeviceScanActivity.rar
this is quite old question, but for future readers I just want to propose to check out official source codes provided by Bluetooth SIG:
Application Accelerator
There are small, easy to understand and documented apps for most mobile platforms (Android, iOS, Windows Phone and more) + some materials/tutorials. If you want to start playing with BLE this is the best starting point in my opinion.
Everything is free, but you need to register on the website. As far as I remember there is maybe 1-3 emails by year, all connected with new tools for Bluetooth development.
Darek