Android BLE code is not properly working on Samsung devices whereas it works with other android devices .
Some time we are able to get values doing some work around but it is not works as smooth as we required.
I wonder about the Samsung device behavior any one help me to know about what is the main reason behind the same and what is the permanent solution of the same.
You are using the Bluetooth 4.0, you must update the Samsung mobile phone system to more than 4.3 .
Android 4.3 (API Level 18) introduces built-in platform support for Bluetooth Low Energy in the central role and provides APIs that apps can use to discover devices, query for services, and read/write characteristics
See https://developer.android.com/guide/topics/connectivity/bluetooth-le.html for details.
Related
Is that possible to implement iBeacon API for android 4.2 and lower with BLE?
update:
According to davidgyoung, theoretically it's possible to enable ibeacon in BLE enabled devices with android 4.3- only if building up a ibeacon API from bottom.
Bluetooth low energy technology was only added in Android 4.3+.
Prior Android devices also did not had Bluetooth chips capable of BLE (standard v4.0).
So no, you cannot make a device without a BLE chip work as a BLE chip (and even if you did, it would make no sense nor use).
Android phones must have both Bluetooth 4.0 hardware and a SDK to detect iBeacons. Generally this means Android 4.3+ and a phone made in late 2012 or later.
Samsung phones include a proprietary Bluetooth 4.0 SDK for their devices with Bluetooth 4.0 chips and Android versions 4.1 and 4.2. Devices like the Galaxy S3 shipped with this.
There is no off-the-shelf iBeacon detection library using this SDK, so if you want to detect iBeacons on these devices, you would have to roll your own.
Also, keep in mind that many if not most of these devices are already getting upgrades to Android 4.3, so this is a shrinking pool of devices for which this is possible and necessary. For non-Samsung devices and Samsung devices manufactured before late 2012, it is not possible at all due to lack of a Bluetooth 4.0 library or Bluetooth 4.0 hardware.
Till Android 4.3, an Android device with Bluetooth Low Energy support could only act as a central device. As is given in the Android 4.3 Bluetooth LE docs:
Android 4.3 (API Level 18) introduces built-in platform support for Bluetooth Low Energy in the central role and provides APIs that apps can use to discover devices, query for services, and read/write characteristics.
With the introduction of Android 4.4 KitKat, can it also behave as a peripheral device now? I couldn't find any documentation of that. If not, then do we have to wait for Android 4.5 for getting the BTLE peripheral mode on Android device? Or is there any alternative way in which an Android device can be made to act as a peripheral device?
Not in this version but there is evidence that it is coming soon.
If you look in BluetoothGatt.java in the android-19 sources there are new methods listen and setAdvData that weren't there in android-18.
However these are not documented as I don't think native support is complete yet. The last check in on AOSP for peripheral mode was titled "LE: Add peripheral role support (2/4)". Also, setAdvData and listen have this code:
if (mContext == null || !mContext.getResources().getBoolean(com.android.internal.R.bool.config_bluetooth_le_peripheral_mode_supported))
{
throw new UnsupportedOperationException("BluetoothGatt#listen is blocked");
}
Looking in android/platform_frameworks_base/blob/master/core/res/res/values/config.xml from the Android sources you can see this is currently disabled:
<!-- Boolean indicating if current platform supports BLE peripheral mode -->
<bool name="config_bluetooth_le_peripheral_mode_supported">false</bool>
Thanks everyone for the answers. Just to update, as of June 2014, it is offered in the Android L Developer preview. Hope to see it in the Android L official release. 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:
The bad news 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.
http://developer.android.com/sdk/api_diff/19/changes.html
By looking at the full api difference, the answer in short : NO
==============
To add peripheral role support now you have to get your hands dirty to customize the Bluedroid stack in the OS level, or try your luck on XDA developers to see if anyone has done this before. I am not sure the current Android phone support peripheral role at hardware level,though .
Im doing an android app to pair a non-android device with bluetooth 4.0 LE, but my 4.0Bluetooth-android-phone doesnt discover the device anyway. I discover other devices like phones, or tablets.
The question is: Do i have to add some extra code if i want to work with bluetooth 4.0 devices?
Thanks.
Bluetooth 4.0 (or BLE) is not supported in Android at the moment. It will be supported in Android 4.3 (API level 18). Among other places, you can read more about it here and here. Several Android devices has already been certified with Bluetooth 4.0 support, but it won't work before the update is released.
That said, according to this post some devices does support it, but they need custom BLE libraries that the companies have developed.
I am involved in a Android Project that connects the sensor using Bluetooth 4.0. AFAIK android didn't support Bluetooth 4.0. I tried with my laptop bluetooth 4.0. I tried with Broadcom using this. Later i came to know my Laptop Bluetooth 4.0 is Atheros Bluetooth 4.0 and later i searched for Atheros Bluetooth 4.0 API using android mobiles and tablets. I saw Qualcomm having Bluetooth 4.0 tablet. I want to know, is Atheros giving API for Bluetooth 4.0 for Android SDK.
Finally, long way of search, i found that up to today(23/12/12), Atheros not giving Bluetooth API for developers. But they are providing other API's for Audio, Camera, Device Info and Sensor(mobile shake). So, can't try on laptop also. Dgel comment and link helped me a lot and made me, come to the conclusion.
Android Bluetooth (and other) API's are not specific to the hardware (or software stack).
They are generic and fairly high-level, and Yes they include Bluetooth 4.0.
The actually support for BT 4 depends on the device. Recent Nexus devices support BT4 (both in hardware and in software) as long as they have the Android 4.2 update.
If you root your device you can get to the 'raw' vendor API's, but I don't know what that looks like for BT4, or wheteher any of that is published. In most cases that is Broadcom based, not Atheros.
EDIT:
I just saw this:
http://code.google.com/p/broadcom-ble/
I'm not familiar with this, but I suspect that it was just a stop gap measure before BT4 was added to the official Android API in 4.1.
I'm trying to develop a bluetooth 4.0 app for S3. The problem is, the phone behaves like it doesn't even have bluetooth 4.0. It doesn't discover 4.0 devices, and isn't discoverable with 4.0 devices. I tried both in the settings of the phone and in an app, using the Broadcom-ble API. The Broadcom API doesn't have any extra functionality for finding/discovering 4.0 devices, rather it uses the regular BluetoothAdapter functionality and claims that it will be augmented in 4.0 phones to also discover 4.0 devices.
Has anybody tried using bluetooth 4.0 on the S3? Has anyone succeeded in using the Broadcom API?
Thanks in advance.
This is now a confirmed bug, that will be fixed "in future releases".
See this forum thread at Samsung.
A beta for Samsung BLE SDK has been released here. I am going to study this SDK and hopefully it solves some of my problems.
It has been reported by Andrew Dodd, a senior XDA developer, that the Galaxy S3 doesn't actually support Bluetooth Low Energy
The Galaxy S3 has been marketed as Bluetooth 4.0 Low Energy (aka Bluetooth Smart) since its release - but it is not actually BTLE capable -http://developer.samsung.com/forum/board/thread/view.do?boardName=GeneralB&messageId=157757 - Samsung is STILL advertising the device as BTLE capable when it is NOT, despite the fact that they have been aware of this false advertising for months.
Samsung have a page at:
http://developer.samsung.com/ble
where you can download a Bluetooth LE SDK and sample code (registration is required, but otherwise it's automatic).
For what it's worth, there's an HTC page at:
http://www.htcdev.com/devcenter/opensense-sdk/partner-apis/bluetooth-low-energy/
where you can request access to their 'Partner APIs'. This needs license agreements to be signed (which for me means lots of lawyering) so I've not actually got code from them yet..
Ian
Refer this link
http://e2e.ti.com/support/low_power_rf/f/538/p/240097/879328.aspx
http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/538/8880.S3-BLE.zip,
attachment package can run on Samsung S3, now it limit with discover BLE devices and pairing. Some recent days, i try to find out how to send/receive data. But still not any luck.
I hope it can help.
Update your phone to Jelly Bean, then download nRf Utility from the Play Store, it can scan BLE devices around you!