Java Code Examples for android.bluetooth.BluetoothAdapter#isMultipleAdvertisementSupported()
The following examples show how to use
android.bluetooth.BluetoothAdapter#isMultipleAdvertisementSupported() .
These examples are extracted from open source projects.
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 Project: DeviceConnect-Android File: AbstractHOGPServer.java License: 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 Project: Bluefruit_LE_Connect_Android_V2 File: GattServer.java License: 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 Project: DeviceConnect-Android File: BleUtils.java License: 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 Project: AsteroidOSSync File: L_Util.java License: GNU General Public License v3.0 | 4 votes |
public static boolean isAdvertisingSupportedByChipset(BluetoothAdapter adapter) { return adapter.isMultipleAdvertisementSupported(); }
Example 5
Source Project: SweetBlue File: L_Util.java License: GNU General Public License v3.0 | 4 votes |
public static boolean isAdvertisingSupportedByChipset(BluetoothAdapter adapter) { return adapter.isMultipleAdvertisementSupported(); }