Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out if Android device supports Bluetooth Low Energy

Tags:

It seems Nexus 7 first generation doesn't support Bluetooth Low Energy, at least when I follow exactly steps from tutorial

http://developer.android.com/guide/topics/connectivity/bluetooth-le.html

I do have app finish on following code:

 if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {     Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();     finish(); } 

Sure I checked, that Bluetooth enabled.

So the question is, how to find out for sure, if the device supports Bluetooth Low Energy standard?

UPDATE: I'm using android 4.3

like image 985
Andriy Kopachevskyy Avatar asked Sep 18 '13 13:09

Andriy Kopachevskyy


People also ask

What phones support Bluetooth Low Energy?

Mobile operating systems including iOS, Android, Windows Phone and BlackBerry, as well as macOS, Linux, Windows 8, Windows 10 and Windows 11, natively support Bluetooth Low Energy.

How do I enable BLE on Android?

Once your app has permission to use Bluetooth, your app needs to access the BluetoothAdapter and determine if Bluetooth is available on the device. If Bluetooth is available, the device will scan for nearby BLE devices.

What version of Bluetooth is low energy?

Versions 4.0 – 5.0: Bluetooth Low Energy In order to meet the increasing demand for wireless connectivity between small devices, Bluetooth 4.0 was introduced to the market with a new category of Bluetooth: Bluetooth Low Energy (BLE).


2 Answers

Your code is really good, But do you add the following code exactly?

<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> 

The important code is :

<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/> 

Because we need to make sure the application can run succesfully,

However, if you want to make your app available to devices that don't support BLE, you should still include this element in your app's manifest, but set required="false"

That code works for me.

EDIT: I found something good for you about which devices be compatible with BLE feature

like image 160
Huy Tower Avatar answered Sep 20 '22 04:09

Huy Tower


You are supposed to check for the 'feature':

PackageManager pm = ctx.getPackageManager(); boolean hasBLE = pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); 

I'm not really sure how seriously the manufacturers take this though - the only feature I've checked myself is FEATURE_TELEPHONY and different manufacturers handle it in different (and puzzling) ways, so your mileage may vary, but I do believe that this is the way you are intended to do it.

like image 21
Tom Avatar answered Sep 18 '22 04:09

Tom