Created
February 4, 2021 10:00
-
-
Save KamikX/f3d372a4e9a71197ef9e8dc5b6174639 to your computer and use it in GitHub Desktop.
Android check BLEv5 support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.bluetooth.BluetoothAdapter | |
import android.os.Build | |
import androidx.annotation.RequiresApi | |
@RequiresApi(Build.VERSION_CODES.O) | |
fun BluetoothAdapter.hasBleV5Support(): Boolean { | |
if (isLe2MPhySupported | |
|| isLeCodedPhySupported | |
|| isLeExtendedAdvertisingSupported | |
|| isLePeriodicAdvertisingSupported | |
|| leMaximumAdvertisingDataLength > 31) { // BLE 4.X message capacity is only 31 bytes. | |
return true | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment