Java Code Examples for android.bluetooth.BluetoothAdapter#isMultipleAdvertisementSupported()
The following examples show how to use
android.bluetooth.BluetoothAdapter#isMultipleAdvertisementSupported() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractHOGPServer.java From DeviceConnect-Android with MIT License | 6 votes |
/** * コンストラクタ. * @param context このインスタンスが属するコンテキスト * @throws UnsupportedOperationException BluetoothやBLEがサポートされていない場合に発生 */ AbstractHOGPServer(final Context context) throws UnsupportedOperationException { mApplicationContext = context.getApplicationContext(); final BluetoothManager btMgr = (BluetoothManager) mApplicationContext.getSystemService(Context.BLUETOOTH_SERVICE); final BluetoothAdapter btAdapter = btMgr.getAdapter(); if (btAdapter == null) { throw new UnsupportedOperationException("Bluetooth is not available."); } if (!btAdapter.isEnabled()) { throw new UnsupportedOperationException("Bluetooth is disabled."); } if (!btAdapter.isMultipleAdvertisementSupported()) { throw new UnsupportedOperationException("Bluetooth LE Advertising not supported on this device."); } mBluetoothLeAdvertiser = btAdapter.getBluetoothLeAdvertiser(); if (mBluetoothLeAdvertiser == null) { throw new UnsupportedOperationException("Bluetooth LE Advertising not supported on this device."); } }
Example 2
Source File: GattServer.java From Bluefruit_LE_Connect_Android_V2 with MIT License | 5 votes |
private void onBluetoothStateChanged(Context context) { // Setup advertiser BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null) { if (!adapter.isEnabled()) { Log.w(TAG, "BluetoothLE is disabled"); } if (!adapter.isMultipleAdvertisementSupported()) { Log.w(TAG, "Multiple advertisement not supported"); } mAdvertiser = adapter.getBluetoothLeAdvertiser(); if (mAdvertiser == null) { Log.w(TAG, "Device does not support Peripheral Mode"); } } else { Log.w(TAG, "Device does not support Bluetooth"); } if (mAdvertiser == null) { mIsAdvertising = false; } if (mShouldStartAdvertising && mAdvertiser != null) { startAdvertising(context); } }
Example 3
Source File: BleUtils.java From DeviceConnect-Android with MIT License | 5 votes |
/** * BLEペリフェラルがサポートされているか確認を行います. * * @param context このアプリケーションが属するコンテキスト * @return サポートされている場合はtrue、それ以外はfalse */ @SuppressLint("NewApi") public static boolean isBlePeripheralSupported(@NonNull final Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return false; } BluetoothAdapter bluetoothAdapter = getAdapter(context); return bluetoothAdapter != null && bluetoothAdapter.isMultipleAdvertisementSupported(); }
Example 4
Source File: L_Util.java From AsteroidOSSync with GNU General Public License v3.0 | 4 votes |
public static boolean isAdvertisingSupportedByChipset(BluetoothAdapter adapter) { return adapter.isMultipleAdvertisementSupported(); }
Example 5
Source File: L_Util.java From SweetBlue with GNU General Public License v3.0 | 4 votes |
public static boolean isAdvertisingSupportedByChipset(BluetoothAdapter adapter) { return adapter.isMultipleAdvertisementSupported(); }