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

bug: iOS advertisment manufactuer data is not available when scanning while app is in background #1046

Open
drolpi opened this issue Feb 20, 2025 · 5 comments

Comments

@drolpi
Copy link

drolpi commented Feb 20, 2025

When I run a scan task while my app is in background the manufacturer data is not included in the advertisement data.

I am using capacitor v7 and iOS 18.3.

@peitschie
Copy link
Collaborator

Hi @drolpi

This sounds like a passive vs active scan difference: https://uynguyen.github.io/2020/08/23/Best-practice-Advanced-BLE-scanning-process-on-iOS/

If the advertisement data is important, you'll want to shift it from the scan response packet into the primary advertise packet 🙂

Unfortunately, there's nothing we can do from the plugin side.

@drolpi
Copy link
Author

drolpi commented Feb 20, 2025

@peitschie what do you mean with "shift it from the scan response packet into the primary advertise packet"?

@drolpi
Copy link
Author

drolpi commented Feb 20, 2025

On the peripheral side?

@peitschie
Copy link
Collaborator

@drolpi correct. This is a peripheral side change. This is the difference between the advertising packet (ADV_IND) and the scan response packet (SCAN_RSP): https://stackoverflow.com/questions/75292547/are-ble-devices-required-to-respond-to-a-scan-req-requests

The fact this only shows up when the application is in the foreground means the peripheral only provides the data in the scan response. If it's critical to receive this data in the background, the only solution is for the peripheral to instead send the data in the advertising packet itself.

@peitschie
Copy link
Collaborator

You can see the distinction more clearly using something like nrf Connect (Android, but they may have an iPhone equivalent)

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

No branches or pull requests

2 participants