Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
microgeniusz80 opened this issue Sep 3, 2023 · 3 comments

Comments

@microgeniusz80
Copy link

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
Copy link

aleadag commented Dec 5, 2023

same issue here, any suggestion?

@karthicbz
Copy link

karthicbz commented Dec 19, 2023

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
Copy link

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants