app/src/main/java/com/shoaibsaikat/ble/ServerActivity.java
//Public method to begin advertising services
Public method to begin advertising services
Public method to begin advertising services
public void startAdvertise() {
        if (isAdvertising)
            return;
        enableBluetooth();
        startGattServer();
        AdvertiseData.Builder dataBuilder = new AdvertiseData.Builder();
        AdvertiseSettings.Builder settingsBuilder = new AdvertiseSettings.Builder();
        dataBuilder.setIncludeTxPowerLevel(false); 
        dataBuilder.setIncludeDeviceName(true);
        for (ParcelUuid serviceUuid : mServiceUuids)
        	dataBuilder.addServiceUuid(serviceUuid);
        settingsBuilder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED);
        settingsBuilder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH);
        mBluetoothLeAdvertiser.startAdvertising(settingsBuilder.build(), dataBuilder.build(), advertiseCallback);
        isAdvertising = true;
    }
public void startAdvertise ( ) { if ( isAdvertising ) return ; enableBluetooth ( ) ; startGattServer ( ) ; AdvertiseData . Builder dataBuilder = new AdvertiseData . Builder ( ) ; AdvertiseSettings . Builder settingsBuilder = new AdvertiseSettings . Builder ( ) ; dataBuilder . setIncludeTxPowerLevel ( false ) ; dataBuilder . setIncludeDeviceName ( true ) ; for ( ParcelUuid serviceUuid : mServiceUuids ) dataBuilder . addServiceUuid ( serviceUuid ) ; settingsBuilder . setAdvertiseMode ( AdvertiseSettings . ADVERTISE_MODE_BALANCED ) ; settingsBuilder . setTxPowerLevel ( AdvertiseSettings . ADVERTISE_TX_POWER_HIGH ) ; mBluetoothLeAdvertiser . startAdvertising ( settingsBuilder . build ( ) , dataBuilder . build ( ) , advertiseCallback ) ; isAdvertising = true ; }
Public method to begin advertising services
Public method to begin advertising services
//necessity to fit in 31 byte advertisement