react-native-peripheral icon indicating copy to clipboard operation
react-native-peripheral copied to clipboard

Advertising two different services sequentially

Open trkdgnr opened this issue 3 years ago • 3 comments

Hello,

We are trying to advertise two different data with a certain delay, our intended workflow looks like this:

  • Create a characteristic and a service
  • Start advertising
  • Stop advertising after 10 seconds
  • Remove previously added service
  • Create another characteristic and service
  • Start advertising again but with different name
  • Stop after 10 seconds again

However, the receiver device receives the old service with the old name. While we are searching for a solution online, we found that it may be caused by the bluetooth cache of the devices. Currently, we do not know if it is due to the cache of the advertising device or the receiver device. Assuming that we have the ability to refresh the cache within the capabilities of React Native, is it possible to implement a workflow such as the above one?

trkdgnr avatar Dec 20 '21 14:12 trkdgnr

Upon different trials, I believe we discovered that Peripheral.stopAdvertising() does not work because even after we close the application, our receiver device keeps receiving the data while the advertising device's bluetooth is enabled.

trkdgnr avatar Dec 20 '21 15:12 trkdgnr

@trkdgnr did you ever find a solution?

whatnottodo avatar Mar 10 '22 09:03 whatnottodo

I do agree, there should be some triggers for this situation. However having the broadcasts continue after backgrounding the app and closing the app are wonderful. That said, upon returning to the app (which is still advertising) checking that status results in a "false: value

Vercjames avatar Nov 03 '22 22:11 Vercjames