capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
284 stars 86 forks source link

fix(android): register state receivers as REGISTER_EXPORTED #663 #667

Closed peitschie closed 4 months ago

peitschie commented 4 months ago

I haven't got many devices to test this on currently, but this should be the code change needed here.

pwespi commented 4 months ago

Thank you @peitschie for looking into this. However I cannot reproduce the problem described in https://github.com/capacitor-community/bluetooth-le/issues/663. Do you have a case where that crash happened?

pwespi commented 4 months ago

@allcontributors please add @peitschie for code and question

allcontributors[bot] commented 4 months ago

@pwespi

I've put up a pull request to add @peitschie! :tada:

peitschie commented 4 months ago

@pwespi huh... you are 100% correct here.

I'd seen this on at least one of the registerReceivers on another plugin, and assumed it applied more widely than it actually does.

There is a carved out exception for System Broadcasts when using a Context#registerReceiver call: https://developer.android.com/about/versions/14/behavior-changes-14#system-broadcasts which looks like it covers all the usages you have here.

This change isn't necessary at all. Sorry for the wasted time.