How to detect Bluetooth LE advertisements on Android - android

Does anyone know the best way to detect Bluetooth LE advertisements on a Android device? I need to only retrieve the service UUID and RSSI value from the advertisement packet, I don't need to connect with the device--If this makes a difference. Do I need to use one of the vendor specific Bluetooth API's like Broadcom for a device that contains a Broadcom bluetooth module?

As of Android version 4.2, the Broadcom stack has been integrated into Android and will work out of the box. Prior to that you needed to run another stack to give BLE access, as stock Android had no APIs.

As of SDK 18 Android now has APIs for this. However, in my testing they do not work properly on the Nexus 4 with 4.3.
See documentation here:
http://developer.android.com/guide/topics/connectivity/bluetooth-le.html

Related

Communcation between devices using only BLE

I want to connect two android phone only via BLE. Is it possible? because as per my understanding using Android API I can only connect with BLE enabled devices like smartwatches headphones etc. If I run startLescan() method it only shows my fitness band and headphone.
It does not show other android phones.
Yes its possible. As the hardware equally supports to act as a master or slave, but it depends on whether the OS has provide you the required interface to make a device act as master as well as slave. THe BLE in android phone is equally capabale of becoming a master or peripherical but it depends on whehter android has exposed some interface to make it work ortherwise if not you have to root/reflash your device and make changes at OS level.
Yes, two BLE devices can communicate and has been ever since the original 4.0 release.
The change in 4.1 states that a single device can act as both a master and as a slave simultaneously to two different devices. Once device has to act as periphiral and other as master.
See this: http://www.blemobileapps.com/ble-mobile/
For android this link might be helpful for you: https://code.tutsplus.com/tutorials/how-to-advertise-android-as-a-bluetooth-le-peripheral--cms-25426
Reference: Chipsets/Devices supporting Android 5 BLE peripheral mode
Let me know if this answers your question.
It is possible to connect to Android phone with BLE.
One of the phones has to be a BLE Server and must advertise itself
(a role usually performed by devices like smartwatches and headphones) to be discovered by the other phone.
To advertise itself the app uses the BluetoothLeAdvertiser class.
Such API was added starting from level 21 Lollipop so your server phone should be at least a 5.0 Android device.
Personally I found this tutorial by Andrew Lunsford very useful for understanding how to realize such functionality.

Make Samsung Android device advertise as an iBeacon

Has anybody used Samsung's Bluetooth LE APIs to make a Samsung Android device advertise as an iBeacon? This should be possible, but I do not have access to a device to try it.
If anybody has used it to make a Samsung Android device advertise as any other Bluetooth LE peripheral, I would like to know that, too.
EDIT: This is now possible on Android L. See here.
EDIT: this answer is about older Samsung phones with Android 4.2. Samsung devices with Android 5.0+ can advertise beacons successfully.
Unfortunately, #reTs and #duncan-c are right (+1 for each of them). The Samsung BLE SDK cannot send out real BLE advertisements as is required for iBeacons.
I was holding out hope because their documentation says "allowing applications to create and advertise Bluetooth smart services and characteristics". I wrote an app to prove whether this actually worked, and learned that their documentation is simply misleading. The Samsung BLE SDK will not make Samsung devices transmit advertisements over the radio.
See full details in this blog post.
http://developer.samsung.com/ble
You can view the official "Samsung BLE SDK Guide and Hints" on the above link.
On page 12, point 10, it said :
"The current version of the SDK supports only the GATT central role. Peripheral roles may
be supported in future releases."
I'm told that with the current firmware it's not possible. (I'm not an Android developer so I haven't confirmed this first-hand.)

Detect proximity using Bluetooth LE "Proximity" profile Android

Problem definition:
I've been trying to use BLE proximity profile for Bluetooth LE on Android. Some of the devices like new generation Google Nexus tablet with 4.3 Android support BLE and can act as a central device.
I read the Android official documentation of the Bluetooth LE but their doesn't seems any support for that. Is their any workaround to implement our own proximity profile?
Questions which talk about proximity profile on Android but are of no help
Reading Bluetooth RSSI for BLE proximity profile in Android.
How to use the profile of PROXIMITY PROFILE,IMMEDIATE ALERT SERVICE and Find Me Profile in android 4.3 BLE?
BTLE (Bluetooth Low energy) development kit - must have proximity profile
Any help is appreciated. Thanks.
June 2014:
Thanks everyone for the answers. Just to update, as of June 2014, BLE Peripheral mode is offered in the Android L Developer preview. So now Android devices can act both in peripheral and central role. Hope to see it in the Android L official release. Quoting from their blog New in Android: L Developer Preview and Google Play Services 5.0:
The L Developer Preview, lets you explore many of the new features and capabilities of the next version of Android, and offers everything you need to get started developing and testing on the new platform. Here are a few of the highlights for developers:
BLE Peripheral Mode — Android devices can now function in Bluetooth Low Energy (BLE) peripheral mode. Apps can use this capability to broadcast their presence to nearby devices — for example, you can now build apps that let a device to function as a pedometer or health monitor and transmit data to another BLE device.
Update 16th October 2014:
Its out now! Checkout Android 5.0 wireless changes page.
Update 8th December 2014:
The bad new is that BLE Peripheral mode will only work on the newer Android devices (as per the date), viz Nexus 6 and Nexus 9. It won't work on Nexus 4/ Nexus 5/nexus 7/ nexus 10 even if you update it to Android 5.0. You can read the comment by one of the Android Project manager on BLE advertise mode not working ticket. He says:
We introduced BLE peripheral mode in Android 5.0 Lollipop. Nexus 6 and Nexus 9 are the first two production Nexus devices that support BLE peripheral mode. Due to hardware chipset dependency, older Nexus devices (4/5/7) will not have access to the feature on Lollipop.
Thanks to Rob Anderson for informing.
To elaborate on shubhams's answer:
Unfortunately there is no way for Android devices to act as a peripheral. He can creates GATT servers, services and charachteristics but there is no way to make the advertising.
(https://stackoverflow.com/a/18020153/3061383)
Since Android does not (yet) support advertising no other BLE device is able to initiate a connection to an Android device. As of now the Android device must initiate the connection.
Unfortunately, the android can only act as central not peripheral. So custom profiling is not possible at this point of time. Rather you can use the profile which are being provided by gatt.
For example: Temperature Monitor profile. Instead you can make the custom service and characteristics on iPhone and make it work as beacon.
Also if you are using hardware device of Estimote and other companies, you can reply back the data from android device i.e Services and characteristics have the properties such as Read, Write and Notify. But when you are making iPhone as Beacon, then you won't be able to receive the value from android device.

Android 4.3 as a Bluetooth LE Peripheral

Quick question. I can't seem to find this in the Android docs, so I don't think it is possible, but is it possible to have an Android 4.3 device (in my case, a Nexus 4) behave as a Bluetooth peripheral? I know iOS supports both peripheral and central, but it seems like Android only supports central.
I'd like to connect an Android device to a Mac using Bluetooth LE, but since OS X doesn't support peripheral mode and it looks like Android doesn't either, I might have to go with Bluetooth 2 or another communication method.
Unfortunately there is no way for Android devices to act as a peripheral. He can creates GATT servers, services and charachteristics but there is no way to make the advertising.
Doc: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
The phone supports the central role;
I'm waiting for this feature too, but it seems we have to wait for next Android releases.
Yeah, Android 4.3 does not support peripheral mode. I started a feature request on the Android Open Source Project website. If you also want to see this feature, add a comment or star the post. I think they will get around to it eventually, but it is good to let them know that this is a feature that developers are looking for.
https://code.google.com/p/android/issues/detail?can=2&q=59693&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&id=59693
issue: 59693
In API level 4, 4.1,4.2,4.3 its not possible.
Android lollipop API version 5.0.X sdk supports peripheral mode in BLE however this feature is chipset dependent (Phones).
android phones with Broadcom Bluetooth solution already supports it
If you have a Nexus 5 you can install Android L there and try it, I just did it few months ago, Android L has support to act as a peripheral.

how to define bluetooth version a system support

Bluetooth 4.0 is same as Bluetooth 4.0 LE? , i.e. iPhone4s supports bluetooth 4.0,
does that mean iPhone4s supports bluetooth 4.0 LE ?
I know that bluetooth 3.0 != bluetooth 3.0 HS
My android phone project, msm7225A platform, bluetooth chip is WCN2243.
which version can be defined?
In short, from hardware and software aspects, how to confirm Bluetooth version
(when using bluez stack, and take android phone for an example)
it is really a problem that confusing me for a long time.
appreciate anyone give some help.
Not sure if I got your questions correctly, but maybe this helps:
Bluetooth 4.0 specifies two modes of operation: "classic" Bluetooth and "Bluetooth Low Energy (LE)". iPhone 4S's Bluetooth is dual mode, i.e. it supports both classic & LE. IOS, though, only supports programming the latter (LE) directly via the public CentralManager API. There is no way to directly access the "classic" Bluetooth stack in IOS.
The standard Android SDKs only support classic Bluetooth. If you want to use LE, this answer suggests to use a manufacturer API.
BlueZ supports LE's GATT server at least. I haven't worked with that though, so I can't tell how complete LE support is. If you're about to use BlueZ directly on Android phones, mind that this will only work if the user has root access.
To answer more generally, LE could/should also have been published without calling it "Bluetooth" at all. So to determine if the hardware/software supports classic and/or LE, you'll have to look at the specs for each platform you're targeting.

Categories

Resources