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
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.
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.
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).
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With