juliansteenbakker / flutter_ble_peripheral

A Flutter package for advertising BLE data in peripheral mode
BSD 3-Clause "New" or "Revised" License
72 stars 50 forks source link

stopAdvertising is automatically called, within 0.5second of advertisement started #150

Open microgeniusz80 opened 1 year ago

microgeniusz80 commented 1 year ago

latest library update causes advertisement not showing anymore.

I/BluetoothLeAdvertiser(15672): startAdvertising is called I/BluetoothAdapter(15672): isLeEnabled(): ON I/BluetoothLeAdvertiser(15672): startAdvertisingSet, calling package name = dev.steenbakker.flutter_ble_peripheral_example I/BluetoothAdapter(15672): isLeEnabled(): ON I/FlutterBlePeripheral(15672): onStartSuccess() mode: 2, txPOWER 1 I/BLE Peripheral state (15672): advertising I/BluetoothLeAdvertiser(15672): stopAdvertising is called I/BluetoothLeAdvertiser(15672): stopAdvertisingSet, calling package name = dev.steenbakker.flutter_ble_peripheral_example V/AudioManager(15672): querySoundEffectsEnabled... I/BluetoothLeAdvertiser(15672): stopAdvertising is called

it seems that as soon as I/BLE Peripheral state (15672): advertising happened, within a second: I/BluetoothLeAdvertiser(15672): stopAdvertising is called.

I/BLE Peripheral state (15672): advertising I/BluetoothLeAdvertiser(15672): stopAdvertising is called These two lines were generated together when the start advertising button was clicked.

causing, it not to show any advertisement

previous version was fine

aleadag commented 9 months ago

same issue here, any suggestion?

karthicbz commented 8 months ago

same issue here, any suggestion?

set duration in AdvertiseSettings final AdvertiseSettings advertiseSettings = AdvertiseSettings(timeout: 50000);

then start advertising

await FlutterBlePeripheral().start(
      advertiseData: advertiseData,
      advertiseSettings: advertiseSettings,
    );
stam0912 commented 8 months ago

Are you using android? The timeout is 400ms by default. You need to set the timeout value if you want it advertise longer.

"Limit advertising to a given amount of time. May not exceed 180000 milliseconds. Default: 400 milliseconds"