private void startAdvertising() { if (mBluetoothLeAdvertiser == null) return; AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setConnectable(true) .setTimeout(0) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .build(); AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(false) .addServiceUuid(new ParcelUuid(GattProfile.SERVICE_UUID)) .build(); mBluetoothLeAdvertiser.startAdvertising(settings, data, mAdvertiseCallback); }
private void startAdvertising() { AdvertiseSettings advSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .build(); AdvertiseData advData = new AdvertiseData.Builder() .setIncludeTxPowerLevel(true) .addServiceUuid(Constants.SERVICE_pUUID) .addServiceData(Constants.SERVICE_pUUID, serviceData) .build(); AdvertiseData advScanResponse = new AdvertiseData.Builder() .setIncludeDeviceName(true) .build(); if (mAdvertiser != null) { gattService.startAdvertising(); mAdvertiser.startAdvertising(advSettings, advData, advScanResponse, advCallback); Log.d(TAG, "Started advertisement of mDL service with data " + new String(serviceData)); } else { Log.e(TAG, "mAdvertiser not available!"); } }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static AdvertiseSettings jsonToBleAdvertiseSettings(JSONObject jsonObject) throws JSONException { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); if (jsonObject.has("AdvertiseMode")) { int mode = MbsEnums.BLE_ADVERTISE_MODE.getInt(jsonObject.getString("AdvertiseMode")); builder.setAdvertiseMode(mode); } // Timeout in milliseconds. if (jsonObject.has("Timeout")) { builder.setTimeout(jsonObject.getInt("Timeout")); } if (jsonObject.has("Connectable")) { builder.setConnectable(jsonObject.getBoolean("Connectable")); } if (jsonObject.has("TxPowerLevel")) { int txPowerLevel = MbsEnums.BLE_ADVERTISE_TX_POWER.getInt(jsonObject.getString("TxPowerLevel")); builder.setTxPowerLevel(txPowerLevel); } return builder.build(); }
public BtError startServer(){ BtError error = checkBluetooth(); if(error != BtError.None) return error; bleAdvertiser = btAdapter.getBluetoothLeAdvertiser(); gattServer = btManager.openGattServer(context, gattServerCallback); for(BluetoothGattService service : services){ gattServer.addService(service); } if(bleAdvertiser == null) return BtError.NoServer; AdvertiseSettings.Builder settings = new AdvertiseSettings.Builder(); settings.setAdvertiseMode(advertiseMode); settings.setConnectable(true); settings.setTimeout(0); settings.setTxPowerLevel(advertiseTransmitPower); AdvertiseData.Builder data = new AdvertiseData.Builder(); data.setIncludeDeviceName(advertiseDeviceName); //data.addServiceUuid(new ParcelUuid(SERVICE_COMMUNICATION)); bleAdvertiser.startAdvertising(settings.build(), data.build(), advertiseCallback); serverRunning = true; return BtError.None; }
private void startAdvertising() { BluetoothAdapter bluetoothAdapter = mBluetoothManager.getAdapter(); mBluetoothLeAdvertiser = bluetoothAdapter.getBluetoothLeAdvertiser(); if (mBluetoothLeAdvertiser == null) { Log.w(TAG, "Failed to create advertiser"); return; } AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setConnectable(true) .setTimeout(0) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .build(); AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(false) .addServiceUuid(new ParcelUuid(SERVICE_UUID)) .build(); mBluetoothLeAdvertiser .startAdvertising(settings, data, mAdvertiseCallback); }
/** * Begin advertising over Bluetooth that this device is connectable * and supports the Current Time Service. */ private void startAdvertising() { BluetoothAdapter bluetoothAdapter = mBluetoothManager.getAdapter(); mBluetoothLeAdvertiser = bluetoothAdapter.getBluetoothLeAdvertiser(); if (mBluetoothLeAdvertiser == null) { Log.w(TAG, "Failed to create advertiser"); return; } AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setConnectable(true) .setTimeout(0) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .build(); AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(false) .addServiceUuid(new ParcelUuid(TimeProfile.TIME_SERVICE)) .build(); mBluetoothLeAdvertiser .startAdvertising(settings, data, mAdvertiseCallback); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private AdvertiseSettings makeAdvertiseSetting() { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); //Set advertise mode to control the advertising power and latency. builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY); //Set advertise TX power level to control the transmission power level for the advertising. builder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_ULTRA_LOW); //Set whether the advertisement type should be connectable or non-connectable. builder.setConnectable(CONNECTABLE); //Limit advertising to a given amount of time. builder.setTimeout(TIMEOUT); return builder.build(); }
private void startAdvertising() { if (mBluetoothLeAdvertiser == null) return; AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setConnectable(true) .setTimeout(0) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .build(); AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName(true) .addServiceUuid(new ParcelUuid(UARTProfile.UART_SERVICE)) .build(); mBluetoothLeAdvertiser.startAdvertising(settings, data, mAdvertiseCallback); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void start(String uuidString) { mServiceUUID = UUID.fromString(uuidString); if (mBtAdvertiser == null) { return; } BluetoothGattService btGattService = new BluetoothGattService(mServiceUUID, BluetoothGattService.SERVICE_TYPE_PRIMARY); btGattService.addCharacteristic(mBtGattCharacteristic); BluetoothGattServerCallback btGattServerCallback = createGattServerCallback(mServiceUUID, UUID.fromString(CHARACTERISTIC_UUID)); mBtGattServer = mBtManager.openGattServer(mActivity.getApplicationContext(), btGattServerCallback); mBtGattServer.addService(btGattService); mDataBuilder = new AdvertiseData.Builder(); mDataBuilder.setIncludeTxPowerLevel(false); mDataBuilder.addServiceUuid(new ParcelUuid(mServiceUUID)); mSettingsBuilder=new AdvertiseSettings.Builder(); mSettingsBuilder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); mSettingsBuilder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH); mBleAdvertiser = mBtAdapter.getBluetoothLeAdvertiser(); mBleAdvertiser.startAdvertising(mSettingsBuilder.build(), mDataBuilder.build(), mAdvertiseCallback); }
public void broadcastAsBeacon() { Beacon beacon = new Beacon.Builder() .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6") .setId2("1") .setId3("2") .setManufacturer(0x0118) // Radius Networks. Change this for other beacon layouts .setTxPower(-59) .setDataFields(Arrays.asList(new Long[]{0l})) // Remove this for beacon layouts without d: fields .build(); // Change the layout below for other beacon types BeaconParser beaconParser = new BeaconParser() .setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"); BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser); beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() { @Override public void onStartFailure(int errorCode) { Log.e("Class", "Advertisement start failed with code: " + errorCode); } @Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { Log.i("class", "Advertisement start succeeded."); } }); }
@SuppressLint("InlinedApi") @Override public int setAdvertiseInterval(int advertiseIntervalMs) { Util.log(TAG, "setAdvertiseInterval() called with: advertiseIntervalMs = [" + advertiseIntervalMs + "]"); @Advertiser.Mode int mode; if (advertiseIntervalMs <= 100 + (250 - 100) / 2) { // 100 ms mode = AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY; } else if (advertiseIntervalMs >= 1000 - (1000 - 250) / 2) { // 1000 ms mode = AdvertiseSettings.ADVERTISE_MODE_LOW_POWER; } else { // 250 ms actually mode = AdvertiseSettings.ADVERTISE_MODE_BALANCED; } if (mode != getModifiedOrOriginalBeacon().getAdvertiseMode()) { // restarting a beacon destroys the GATT connection, make sure we use a stopped clone getOrCloneConfiguredBeacon().edit().setAdvertiseMode(mode).apply(); } return getAdvertiseInterval(); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void setToAdvertising(BleManager mgr, final AdvertiseSettings settings, L_Util.AdvertisingCallback callback, Interval delay) { if (Utils.isLollipop()) { L_UtilBridge.setAdvListener(callback); mgr.getPostManager().postToUpdateThreadDelayed(new Runnable() { @Override public void run() { L_Util.getNativeAdvertisingCallback().onStartSuccess(settings); } }, delay.millis()); } }
public AdvertiseSettings createAdvertiseSettings(boolean connectable, int timeoutMillis) { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); builder.setConnectable(connectable); builder.setTimeout(timeoutMillis); builder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH); return builder.build(); }
public void onStartSuccess(android.bluetooth.le.AdvertiseSettings settingsInEffect) { if (settingsInEffect != null) { Log.d("debug", "onStartSuccess TxPowerLv=" + settingsInEffect.getTxPowerLevel() + " mode=" + settingsInEffect.getMode() + " timeout=" + settingsInEffect.getTimeout()); } else { Log.d("debug", "onStartSuccess, settingInEffect is null"); } switchView.setChecked(true); setProgressBarIndeterminateVisibility(false); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Bundle serializeBleAdvertisingSettings(AdvertiseSettings advertiseSettings) { Bundle result = new Bundle(); result.putString( "TxPowerLevel", MbsEnums.BLE_ADVERTISE_TX_POWER.getString(advertiseSettings.getTxPowerLevel())); result.putString( "Mode", MbsEnums.BLE_ADVERTISE_MODE.getString(advertiseSettings.getMode())); result.putInt("Timeout", advertiseSettings.getTimeout()); result.putBoolean("IsConnectable", advertiseSettings.isConnectable()); return result; }
private static RpcEnum buildBleAdvertiseTxPowerEnum() { RpcEnum.Builder builder = new RpcEnum.Builder(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return builder.build(); } return builder.add( "ADVERTISE_TX_POWER_ULTRA_LOW", AdvertiseSettings.ADVERTISE_TX_POWER_ULTRA_LOW) .add("ADVERTISE_TX_POWER_LOW", AdvertiseSettings.ADVERTISE_TX_POWER_LOW) .add("ADVERTISE_TX_POWER_MEDIUM", AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .add("ADVERTISE_TX_POWER_HIGH", AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) .build(); }
private static RpcEnum buildBleAdvertiseModeEnum() { RpcEnum.Builder builder = new RpcEnum.Builder(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return builder.build(); } return builder.add("ADVERTISE_MODE_BALANCED", AdvertiseSettings.ADVERTISE_MODE_BALANCED) .add("ADVERTISE_MODE_LOW_LATENCY", AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY) .add("ADVERTISE_MODE_LOW_POWER", AdvertiseSettings.ADVERTISE_MODE_LOW_POWER) .build(); }
public void onStartSuccess(AdvertiseSettings settingsInEffect) { Log.e("Bluetooth LE advertising started with settings: " + settingsInEffect.toString()); SnippetEvent event = new SnippetEvent(mCallbackId, "onStartSuccess"); Bundle advertiseSettings = JsonSerializer.serializeBleAdvertisingSettings(settingsInEffect); event.getData().putBundle("SettingsInEffect", advertiseSettings); sEventCache.postEvent(event); }
@ReactMethod public void startSharedAdvertisingBeaconWithString(String uuid, int major, int minor,String identifier) { int manufacturer = 0x4C; Beacon beacon = new Beacon.Builder() .setId1(uuid) .setId2(String.valueOf(major)) .setId3(String.valueOf(minor)) .setManufacturer(manufacturer) .setBluetoothName(identifier) .setTxPower(-59) .build(); BeaconParser beaconParser = new BeaconParser() .setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"); this.beaconTransmitter = new BeaconTransmitter(context, beaconParser); this.beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() { @Override public void onStartFailure(int errorCode) { Log.d("ReactNative", "Error from start advertising " + errorCode); } @Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { Log.d("ReactNative", "Success start advertising"); } }); }
private AdvertiseSettings buildAdvertiseSettings() { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_POWER); builder.setTimeout(0); // Advertise as long as Bluetooth is on, blatantly ignoring Google's advice. builder.setConnectable(false); return builder.build(); }
/** * Starts advertising */ public final void startAdvertising() { handler.post(new Runnable() { @Override public void run() { // set up advertising setting final AdvertiseSettings advertiseSettings = new AdvertiseSettings.Builder() .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) .setConnectable(true) .setTimeout(0) .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY) .build(); // set up advertising data final AdvertiseData advertiseData = new Builder() .setIncludeTxPowerLevel(false) .setIncludeDeviceName(true) .addServiceUuid(ParcelUuid.fromString(SERVICE_DEVICE_INFORMATION.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BLE_HID.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BATTERY.toString())) .build(); // set up scan result final AdvertiseData scanResult = new Builder() .addServiceUuid(ParcelUuid.fromString(SERVICE_DEVICE_INFORMATION.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BLE_HID.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BATTERY.toString())) .build(); Log.d(TAG, "advertiseData: " + advertiseData + ", scanResult: " + scanResult); bluetoothLeAdvertiser.startAdvertising(advertiseSettings, advertiseData, scanResult, advertiseCallback); } }); }
private AdvertiseSettings createAdvSettings(boolean connectable, int timeoutMillis) { AdvertiseSettings.Builder mSettingsbuilder = new AdvertiseSettings.Builder(); mSettingsbuilder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); mSettingsbuilder.setConnectable(connectable); mSettingsbuilder.setTimeout(timeoutMillis); mSettingsbuilder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH); AdvertiseSettings mAdvertiseSettings = mSettingsbuilder.build(); if(mAdvertiseSettings == null){ if(D){ Log.e(TAG,"mAdvertiseSettings == null"); } } return mAdvertiseSettings; }
@Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { super.onStartSuccess(settingsInEffect); if (settingsInEffect == null) { Log.e(TAG, "onStartSuccess, settingInEffect is null"); } }
private void startAdvertisingService(final UUID uuid) { if (bluetoothLeAdvertiseCallbacks == null) { bluetoothLeAdvertiseCallbacks = new ArrayList<>(); } AdvertiseCallback advertiseCallback = new AdvertiseCallback() { @Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { Log.d(TAG, "BLE advertising - uuid: " + uuid.toString() + " - onStartSuccess - settings: " + settingsInEffect.toString()); } @Override public void onStartFailure(int errorCode) { Log.w(TAG, "BLE advertising - uuid: " + uuid.toString() + " - onStartFailure - errorCode=" + errorCode); } }; bluetoothLeAdvertiseCallbacks.add(advertiseCallback); bluetoothAdapter.getBluetoothLeAdvertiser().startAdvertising( new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY) .setConnectable(true) .setTimeout(0) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) .build(), new AdvertiseData.Builder() .setIncludeDeviceName(false) .addServiceUuid(new ParcelUuid(uuid)) .build(), advertiseCallback ); }
@Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { getLogger().d("Advertising started successfully."); getServer().invokeAdvertiseListeners(BleServer.AdvertisingListener.Status.SUCCESS, m_listener); succeed(); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) /*package*/ AdvertiseSettings getNativeSettings(BleAdvertisingMode mode, BleTransmissionPower power, Interval timeout) { AdvertiseSettings.Builder settings = new AdvertiseSettings.Builder(); settings.setAdvertiseMode(mode.getNativeMode()); settings.setTxPowerLevel(power.getNativeMode()); settings.setConnectable(isConnectable()); settings.setTimeout((int) timeout.millis()); return settings.build(); }
@Override public final void startAdvertising(AdvertiseSettings settings, AdvertiseData adData, AdvertiseCallback callback) { final BluetoothLeAdvertiser ad = L_Util.getBluetoothLeAdvertiser(m_adaptor); if (ad != null) { ad.startAdvertising(settings, adData, callback); } else { m_bleManager.getLogger().e("Tried to start advertising, but the BluetoothLeAdvertiser was null!"); } }
@Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { if (settingsInEffect != null) { Timber.d("Advertise success TxPowerLv=" + settingsInEffect.getTxPowerLevel() + " mode=" + settingsInEffect.getMode()); } else { Timber.d("Advertise success"); } }
private AdvertiseSettings createAdvSettings() { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); builder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH); builder.setConnectable(true); builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); return builder.build(); }
public Advertiser(SettingsProvider provider) { mAdvertiseSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(provider.getAdvertiseMode()) .setTxPowerLevel(provider.getTxPowerLevel()) .setConnectable(provider.isConnectable()) // oups! https://code.google.com/p/android/issues/detail?id=232219 // .setTimeout(provider.getTimeout()) .build(); }
@Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { mStatus = STATUS_RUNNING; mSettingsInEffect = settingsInEffect; // on start or restart, rebase the clock time used for PDU count estimation mLastPDUUpdateTime = SystemClock.elapsedRealtime(); if (null != mAdvertisersManager) { mAdvertisersManager.onAdvertiserStarted(this); } }
@Override public int getAdvertiseInterval() { switch (getModifiedOrOriginalBeacon().getAdvertiseMode()) { case AdvertiseSettings.ADVERTISE_MODE_LOW_POWER: default: return 1000; case AdvertiseSettings.ADVERTISE_MODE_BALANCED: return 250; case AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY: return 100; } }
/** * Creates an UriioBeacon beacon based on the provided URL registration result. * @param urlResource URL registration info * @param beaconTimeToLive Initial value for the beacon's TTL for issuing ephemeral short URLs. * @return A new beaoon, without saving or starting it. You can adjust any other beacon properties and save it. */ @NonNull public static UriioBeacon createBeacon(UrlResource urlResource, int beaconTimeToLive) { return new UriioBeacon(urlResource.getId(), urlResource.getToken(), beaconTimeToLive, urlResource.getUrl(), AdvertiseSettings.ADVERTISE_MODE_BALANCED, AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM); }
/** * アドバタイジングを開始します. */ private void startAdvertising() { if (DEBUG) { Log.d(TAG, "startAdvertising"); } mHandler.post(new Runnable() { @Override public void run() { // set up advertising setting final AdvertiseSettings advertiseSettings = new AdvertiseSettings.Builder() .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) .setConnectable(true) .setTimeout(0) .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY) .build(); // set up advertising data final AdvertiseData advertiseData = new AdvertiseData.Builder() .setIncludeTxPowerLevel(false) .setIncludeDeviceName(true) .addServiceUuid(ParcelUuid.fromString(SERVICE_DEVICE_INFORMATION.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BLE_HID.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BATTERY.toString())) .build(); // set up scan result final AdvertiseData scanResult = new AdvertiseData.Builder() .addServiceUuid(ParcelUuid.fromString(SERVICE_DEVICE_INFORMATION.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BLE_HID.toString())) .addServiceUuid(ParcelUuid.fromString(SERVICE_BATTERY.toString())) .build(); mBluetoothLeAdvertiser.startAdvertising(advertiseSettings, advertiseData, scanResult, mAdvertiseCallback); } }); }
@Override public void startAdvertising(String uuid, List<ScanResult> closestBeaconId, String fallbackUrl) { stopAdvertising(); advertiser.startAdvertising( new AdvertiseSettings.Builder().setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED).build(), new AdvertiseData.Builder().addServiceUuid(ParcelUuid.fromString(uuid)).build(), callback ); }
public static AdvertiseSettings createAdvSettings(int timeoutMillis) { AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder(); builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED); builder.setConnectable(true); builder.setTimeout(timeoutMillis); builder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH); return builder.build(); }
@Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { if (m_userAdvCallback != null) { m_userAdvCallback.onStartSuccess(fromNativeSettings(settingsInEffect)); } }
public static boolean startAdvertising(BluetoothAdapter adapter, AdvertiseSettings settings, AdvertiseData adData, AdvertisingCallback callback) { final BluetoothLeAdvertiser adv = adapter.getBluetoothLeAdvertiser(); if (adv == null) return false; m_userAdvCallback = callback; adv.startAdvertising(settings, adData, m_nativeAdvertiseCallback); return true; }