static public boolean checkBluetooth(Context context){
BluetoothManager bm = (BluetoothManager) context.getSystemService(BLUETOOTH_SERVICE);
BluetoothAdapter ba = bm.getAdapter();
if (ba == null) {
//Bluetooth is disabled
Log.e(TAG, "BluetoothAdapter not available!");
return false;
}
if(!ba.isEnabled()) {
Log.w(TAG, "BluetoothAdapter not enabled!");
ba.enable();
}
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Log.e(TAG, "Bluetooth LE is not supported");
return false;
}
if(!ba.isMultipleAdvertisementSupported()){
Log.i(TAG, "No Multiple Advertisement Support!");
}
return ba.isEnabled();
}
GattServer.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:RangeThings
作者:
评论列表
文章目录